forked from markstanton/sysbench-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aggregate-results
executable file
·48 lines (37 loc) · 1.08 KB
/
aggregate-results
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -u
usage()
{
cat << EOF
usage: $0 options
This script looks for result directories (results-0, result-1, result-2, etc) created by
run-sysbench and aggregates their output into a CSV which is sent to stdout.
OPTIONS:
-r Directory containing results [./results]
EOF
}
resultsdir=./results
while getopts r: name
do
case $name in
r) resultsdir="$OPTARG";;
?) usage
exit;;
esac
done
printf "result,threads,transactions,trns p/s,deadlocks,dls p/s,read/write requests,r/w reqs p/s,min,avg,max,99 percentile \n"
for result in $( ls -rt $resultsdir | grep result\- | tr "\n" " " ); do
cat $resultsdir/$result/sysbench.* | \
egrep " cat|threads:|transactions:|deadlocks|read/write|min:|avg:|max:|percentile:" | \
sed '1 s/Number of threads: //' | \
tr -d "\n" | \
sed -e 's/Number of threads: /\n/g' \
-e 's/[A-Za-z\/]\{1,\}://g' \
-e 's/read\/write//g' \
-e 's/approx\. 99//g' \
-e 's/per sec.)//g' \
-e 's/ms//g' \
-e 's/(//g' \
-e 's/ */,/g' | \
awk -v d=$result '{$0=d","$0}1'
done