blob: aaab8f5363c0014261e2e647c9a45e9f78ac86eb [file] [log] [blame]
Yulia Portnova058a2882015-02-20 17:59:12 +02001#!/bin/bash
2
3CLIENTS=${CLIENTS:-"16 32 48 64 80 96"}
4TRANSACTINOS_PER_CLIENT=${TRANSACTINOS_PER_CLIENT:-"100 200 300 400 500 600 700 800 900 1000"}
5RESULTS_FILE=${RESULTS_FILE:-"results.json"}
6
7
8createdb -O postgres pgbench
9pgbench -i -U postgres pgbench
10
11echo "{" > $RESULTS_FILE
12
13for num_clients in $CLIENTS; do
14 for trans_per_cl in $TRANSACTINOS_PER_CLIENT; do
15 tps_all=''
16 for i in 1 2 3 4 5 6 7 8 9 10; do
17 tps=$(pgbench -c $num_clients -n -t $trans_per_cl -j 4 -r -U postgres pgbench |
18 grep "(excluding connections establishing)" | awk {'print $3'})
19 tps_all="$tps_all\n$tps"
20 done
21 # calculate average and deviation
22 echo "$num_clients $trans_per_cl: " >> $RESULTS_FILE
23 echo -e $tps_all | awk '{ col=1; array[NR]=$col; sum+=$col; print "col="$col,"sum="sum} END {for(x=1;x<=NR;x++){sumsq+=((array[x]-(sum/NR))^2);} print "[" sum/NR "," sqrt(sumsq/(NR-1)) "], " }' >> $RESULTS_FILE
24 done
25done
26
27echo "}" >> $RESULTS_FILE
28
29