forked from gregs1104/pgbench-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebreport
executable file
·78 lines (62 loc) · 3.79 KB
/
webreport
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#
# webreport.sh connects to the Results database and generates a web page
# as index.htm that includes links to all the results in the database
#
source ./config
OUTFILE="results/index.htm"
RESULTPSQL="psql -h $RESULTHOST -U $RESULTUSER -p $RESULTPORT -d $RESULTDB"
# Emulate 'sed -i' behavior from GNU sed with standard sed instead.
# Needed on platforms like Solaris.
function sed-i {
replace=$1
filename=$2
sed "$replace" ${filename} > ${filename}.new
mv ${filename}.new ${filename}
}
# TODO These two plots should be computed on a per-set basis by the below code
# instead of just having the one combined graph here
$RESULTPSQL -At -F" " -c "select scale,round(avg(dbsize) / (1024 * 1024)) as dbsize,round(avg(tps)) as tps from tests group by scale order by scale" > scaling.txt
gnuplot plots/scaling.plot
mv scaling.png results/
rm scaling.txt
$RESULTPSQL -At -F" " -c "select clients,round(avg(tps)) as tps from tests group by clients order by clients" > clients.txt
gnuplot plots/clients.plot
mv clients.png results/
rm clients.txt
$RESULTPSQL -At -F" " -c "select scale,clients,round(avg(tps)) as tps from tests group by scale,clients order by scale,clients" > 3d.txt
gnuplot plots/3d.plot
mv 3d.png results/
rm 3d.txt
# Generate HTML
echo > $OUTFILE
echo "<img src=\"scaling.png\"><p>" >> $OUTFILE
echo "<img src=\"clients.png\"><p>" >> $OUTFILE
echo "<img src=\"3d.png\"><p>" >> $OUTFILE
# Loop over all the active test sets
SETS=`$RESULTPSQL -A -t -c "select set from tests group by set order by set"`
for SET in $SETS ; do
DESCR=`$RESULTPSQL -A -t -c "select info from testset where set='$SET'"`
echo "<h3>Set" $SET : $DESCR"</h3>" >> $OUTFILE
# Summarize the test set
echo Averages for test set $SET by scale: >> $OUTFILE
$RESULTPSQL -H -c "select set,scale,round(avg(tps)) as tps,round(1000*avg(avg_latency))/1000 as avg_latency,round(1000*avg(percentile_90_latency))/1000 as \"90%<\",round(1000 * avg(max_latency))/1000 as max_latency from tests where tests.set='$SET' group by set,scale order by set,scale;" >> $OUTFILE
echo Averages for test set $SET by clients: >> $OUTFILE
$RESULTPSQL -H -c "select set,clients,round(avg(tps)) as tps,round(1000*avg(avg_latency))/1000 as avg_latency,round(1000*avg(percentile_90_latency))/1000 as \"90%<\",round(1000 * avg(max_latency))/1000 as max_latency from tests where tests.set='$SET' group by set,clients order by set,clients;" >> $OUTFILE
echo Averages for test set $SET by scale and client: >> $OUTFILE
$RESULTPSQL -H -c "select set,scale,clients,round(avg(tps)) as tps,round(1000*avg(avg_latency))/1000 as avg_latency,round(1000*avg(percentile_90_latency))/1000 as \"90%<\",round(1000 * avg(max_latency))/1000 as max_latency from tests where tests.set='$SET' group by set,scale,clients order by set,scale,clients;" >> $OUTFILE
echo Detail for test set $SET: >> $OUTFILE
# Create a line showing the results for every test as an HTML table
$RESULTPSQL -H -c "select set,'<a href=\"' || tests.test || '/\">' || tests.test || '</a>' as test,scale,clients,round(tps) as tps,max_latency, checkpoints_timed+checkpoints_req as chkpts,buffers_checkpoint as buf_check,buffers_clean as buf_clean,buffers_backend as buf_backend,buffers_alloc as buf_alloc, maxwritten_clean as max_clean, buffers_backend_fsync as backend_sync from test_bgwriter right join tests on tests.test=test_bgwriter.test where tests.set='$SET' order by set,scale,clients,tests.test;" > temp.txt
# Now we need to fix lines like this
# <td align="left"><a href="results/201/">201</a></td>
# where PSQL has quoted things we wanted literally
sed-i "s/</</g" temp.txt
sed-i "s/>/>/g" temp.txt
sed-i "s/"/\"/g" temp.txt
cat temp.txt >> $OUTFILE
# Remove row counts
cp $OUTFILE temp.txt
cat temp.txt | grep -v " rows)" > $OUTFILE
done
rm temp.txt