blob: daad49936ef1864ad5a20349fa82baa9ab42e4fe [file] [log] [blame]
Yulia Portnova058a2882015-02-20 17:59:12 +02001#!/bin/bash
Yulia Portnova7ddfa732015-02-24 17:32:58 +02002set -e
Yulia Portnova058a2882015-02-20 17:59:12 +02003
Yulia Portnova886a2562015-04-07 11:16:13 +03004while [[ $# > 1 ]]
5do
6key="$1"
7
8case $key in
9 num_clients)
10 CLIENTS="$2"
11 shift
12 ;;
13 transactions_per_client)
14 TRANSACTINOS_PER_CLIENT="$2"
15 shift
16 ;;
17 *)
18 echo "Unknown option $key"
19 exit 1
20 ;;
21esac
22shift
23done
24
25CLIENTS=$(echo $CLIENTS | tr ',' '\n')
26TRANSACTINOS_PER_CLIENT=$(echo $TRANSACTINOS_PER_CLIENT | tr ',' '\n')
Yulia Portnova058a2882015-02-20 17:59:12 +020027
28
Yulia Portnova886a2562015-04-07 11:16:13 +030029sudo -u postgres createdb -O postgres pgbench &> /dev/null
30sudo -u postgres pgbench -i -U postgres pgbench &> /dev/null
Yulia Portnova058a2882015-02-20 17:59:12 +020031
Yulia Portnova058a2882015-02-20 17:59:12 +020032
33for num_clients in $CLIENTS; do
34 for trans_per_cl in $TRANSACTINOS_PER_CLIENT; do
35 tps_all=''
36 for i in 1 2 3 4 5 6 7 8 9 10; do
Yulia Portnova7ddfa732015-02-24 17:32:58 +020037 echo -n "$num_clients $trans_per_cl:"
38 sudo -u postgres pgbench -c $num_clients -n -t $trans_per_cl -j 4 -r -U postgres pgbench |
39 grep "(excluding connections establishing)" | awk {'print $3'}
Yulia Portnova058a2882015-02-20 17:59:12 +020040 done
Yulia Portnova058a2882015-02-20 17:59:12 +020041 done
42done
43
Yulia Portnova886a2562015-04-07 11:16:13 +030044sudo -u postgres dropdb pgbench &> /dev/null
Yulia Portnova058a2882015-02-20 17:59:12 +020045
Yulia Portnova7ddfa732015-02-24 17:32:58 +020046exit 0
Yulia Portnova058a2882015-02-20 17:59:12 +020047