blob: 2d154bc11c100ce702aeedbef5959fff853335c3 (
plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#!/bin/sh
#
# Copyright 2019-2022 OARC, Inc.
# Copyright 2017-2018 Akamai Technologies
# Copyright 2006-2016 Nominum, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Driver script to run resperf and generate an HTML report of
# the results, with graphs.
#
# Program locations - change these if not in $PATH
resperf=resperf
gnuplot=gnuplot
# The gnuplot terminal type. This determines the image format for the
# plots; "png" or "gif" will both work as long as the corresponding
# terminal support is compiled into your copy of gnuplot.
terminal=png
# Create a unique ID for this report
id=`date '+%Y%m%d-%H%M'`
# Set up file names
reportfile="$id.html"
outputfile="$id.output"
plotfile="$id.gnuplot"
rate_graph="$id.rate.$terminal"
latency_graph="$id.latency.$terminal"
# Run the test
$resperf -P "$plotfile" "$@" >"$outputfile" 2>&1 ||
{ echo "`basename $0`: error running resperf:" >&2;
cat $outputfile >&2;
exit 1;
}
# Create plots
if
$gnuplot <<EOF
set terminal $terminal
set output "$rate_graph"
set title "Query / response / failure rate"
set key top left
set xlabel "Time (seconds)"
set yrange [0:]
plot \
"$plotfile" using 1:3 title "Queries sent per second" with lines, \
"$plotfile" using 1:4 title "Total responses received per second" with lines, \
"$plotfile" using 1:5 title "Failure responses received per second" with lines
EOF
then
:
else
echo "`basename $0`: error running gnuplot" >&2; exit 1;
fi
if
$gnuplot <<EOF
set terminal $terminal
set output "$latency_graph"
set title "Latency"
set key top left
set xlabel "Time (seconds)"
set yrange [0:]
plot \
"$plotfile" using 1:6 title "Average latency (seconds)" with lines
EOF
then
:
else
echo "`basename $0`: error running gnuplot" >&2; exit 1;
fi
# Generate the report
exec >"$reportfile"
cat <<EOF
<html><head></head><body>
<h1>Resperf report $id</h1>
<h2>Resperf output</h2>
<pre>
EOF
cat "$outputfile"
cat <<EOF
</pre>
EOF
cat <<EOF
<h2>Plots</h2>
<p>
<img src="$rate_graph" />
<img src="$latency_graph" />
</p>
</body></html>
EOF
echo "Done, report is in $reportfile" >&2
|