/
graph
executable file
·79 lines (68 loc) · 1.33 KB
/
graph
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
79
#!/usr/bin/env bash
COL=${COL-9}
ABFLAGS=$(cat results/flags)
# Log <msg ...>
#
# <msg ...>
#
log(){
echo "... $@"
}
#
# Output gnuplot script for line graph.
#
# <title> <node> <connect>
#
function line() {
cat <<-EOF
set terminal png
set output "results/graphs/$1.png"
set title "$1 $ABFLAGS"
set size 1,0.7
set grid y
set key left top
set xlabel "request"
set ylabel "response time (ms)"
plot "$2" using $COL smooth sbezier with lines title "node", \\
"$3" using $COL smooth sbezier with lines title "connect", \\
"$4" using $COL smooth sbezier with lines title "rack thin", \\
"$5" using $COL smooth sbezier with lines title "sinatra thin"
EOF
}
#
# Output gnuplot script for bar graph.
#
# <title> <node> <connect>
#
function bar() {
cat <<-EOF
set terminal png
set output "results/graphs/$1.rps.png"
set title "$1 $ABFLAGS"
set size 0.7,0.5
set grid y
set key left top
set ylabel "requests per second"
plot "$1.rps.dat" using 2: xtic(1) with histogram title ""
EOF
}
#
# Graph the output of the given <dir>.
#
# <dir>
#
function graph(){
log graphing $1
local dir=results/benchmarks/$1
line $1 \
$dir/node.js.dat \
$dir/connect.js.dat \
$dir/rack.thin.ru.dat \
$dir/sinatra.thin.ru.dat \
> results/$1.p
gnuplot results/$1.p
}
# Make ./results/graphs
mkdir -p results/graphs
graph hello-world
graph static