resperf-report revision f3ad877eb05befbc862b0233d985758c0caef29a
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews#!/bin/sh
1fdd2470b625a58b57d0b155e6caf8c4fc0afe8aAutomatic Updater#
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Driver script to run resperf and generate an HTML report of
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# the results, with graphs.
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater#
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Program locations - change these if not in $PATH
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsresperf=resperf
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsgnuplot=gnuplot
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# The gnuplot terminal type. This determines the image format for the
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# plots; "png" or "gif" will both work as long as the corresponding
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# terminal support is compiled into your copy of gnuplot.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsterminal=png
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Create a unique ID for this report
ad671240d635376dd8681550eebee799d2e3d1fdAutomatic Updaterid=`date '+%Y%m%d-%H%M'`
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Set up file names
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsreportfile="$id.html"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsoutputfile="$id.output"
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrewsplotfile="$id.gnuplot"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsrate_graph="$id.rate.$terminal"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewslatency_graph="$id.latency.$terminal"
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont
2cbb4ab75757fbb656997a82c14ca07db37d481aAutomatic Updater# Run the test
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews$resperf -P "$plotfile" "$@" >"$outputfile" 2>&1 ||
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews { echo "`basename $0`: error running resperf:" >&2;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews cat $outputfile >&2;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews exit 1;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Create plots
28b3569d6248168e6c00caab951521cc8141a49dAutomatic Updater
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsif
2cbb4ab75757fbb656997a82c14ca07db37d481aAutomatic Updater $gnuplot <<EOF
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsset terminal $terminal
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsset output "$rate_graph"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsset title "Query / response / failure rate"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsset key top left
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsset xlabel "Time (seconds)"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsset yrange [0:]
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsplot \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"$plotfile" using 1:3 title "Queries sent per second" with lines, \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"$plotfile" using 1:4 title "Total responses received per second" with lines, \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"$plotfile" using 1:5 title "Failure responses received per second" with lines
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsEOF
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsthen
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews :
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterelse
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews echo "`basename $0`: error running gnuplot" >&2; exit 1;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsfi
ad671240d635376dd8681550eebee799d2e3d1fdAutomatic Updater
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsif
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $gnuplot <<EOF
d71e2e0c61df16ff37c9934c371a4a60c08974f7Mark Andrewsset terminal $terminal
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterset output "$latency_graph"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterset title "Latency"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsset key top left
ad671240d635376dd8681550eebee799d2e3d1fdAutomatic Updaterset xlabel "Time (seconds)"
ad671240d635376dd8681550eebee799d2e3d1fdAutomatic Updaterset yrange [0:]
ad671240d635376dd8681550eebee799d2e3d1fdAutomatic Updaterplot \
ad671240d635376dd8681550eebee799d2e3d1fdAutomatic Updater"$plotfile" using 1:6 title "Average latency (seconds)" with lines
ad671240d635376dd8681550eebee799d2e3d1fdAutomatic UpdaterEOF
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsthen
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews :
ad671240d635376dd8681550eebee799d2e3d1fdAutomatic Updaterelse
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews echo "`basename $0`: error running gnuplot" >&2; exit 1;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsfi
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Generate the report
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updaterexec >"$reportfile"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updatercat <<EOF
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater<html><head></head><body>
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater<h1>Resperf report $id</h1>
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater<h2>Resperf output</h2>
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater<pre>
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic UpdaterEOF
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updatercat "$outputfile"
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updatercat <<EOF
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews</pre>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsEOF
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
731cc132f22dbc9e0ecd7035dce314a61076d31bAutomatic Updatercat <<EOF
731cc132f22dbc9e0ecd7035dce314a61076d31bAutomatic Updater<h2>Plots</h2>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<p>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<img src="$rate_graph" />
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater<img src="$latency_graph" />
0a7ed88633a680bb881868b75ded4d09a7bbbc50Automatic Updater</p>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews</body></html>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsEOF
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updaterecho "Done, report is in $reportfile" >&2
ca67ebfe9eef0b8f04179f7e511a19e0337a5422Automatic Updater
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews