Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | CLIENTS=${CLIENTS:-"16 32 48 64 80 96"} |
| 4 | TRANSACTINOS_PER_CLIENT=${TRANSACTINOS_PER_CLIENT:-"100 200 300 400 500 600 700 800 900 1000"} |
| 5 | RESULTS_FILE=${RESULTS_FILE:-"results.json"} |
| 6 | |
| 7 | |
| 8 | createdb -O postgres pgbench |
| 9 | pgbench -i -U postgres pgbench |
| 10 | |
| 11 | echo "{" > $RESULTS_FILE |
| 12 | |
| 13 | for 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 |
| 25 | done |
| 26 | |
| 27 | echo "}" >> $RESULTS_FILE |
| 28 | |
| 29 | |