I needed a good tool to easily map the results from my performance tests into human readable graphs. After much R&D I finally settled with the tool called gnuplot. Earlier I used openoffice chart tool for drawing simple charts. But it has limited capabilities and not so easy to customize. With gnuplot I could easily draw my histgrams just by giving all data in a file and giving all commands in a separate file. Following I explain how.
First install gnuplot on your working machine. In ubuntu
apt-get install gnuplot
Then I created my command file called data.p
# set terminal png transparent nocrop enhanced font arial 8 size 420,320
set output 'mygraph.png'
set xlabel "Message Type"
set ylabel "Requests per second"
set boxwidth 0.9 absolute
set style fill solid 1.00 border -1
set style histogram clustered gap 1 title offset character 0, 0, 0
set datafile missing '-'
set style data histograms
set xtics border in scale 1,0.5 nomirror rotate by -45 offset character 0, 0, 0
set xtics ("echoDoubles" 0.00000, "echoInts" 1.00000, "echoMeshInterfaceObjects" 2.00000, "echoSimpleEvents" 3.00000, "echoStrings" 4.00000)
set title "Large Data Sets(500 elements)\nResults from Apache Bench"
set yrange [ 0.00000 : 700. ] noreverse nowriteback
plot 'mydata.dat' using 2:xtic(1) ti col, '' u 3 ti col
It easy to understand the commands by following gnuplot tutorial
Then I created my data file called mydata.dat
# Large Data Sets(500 elements)
#
Region Axis2/C Waspc
echoDoubles 340.07 273.04
echoInts 452.17 318.69
echoMeshInterfaceObjects 162.90 79.40
echoSimpleEvents 101.16 68.78
echoStrings 542.96 270.54
Note that commented lines are interpreted as comments by gnuplot. Data columns are separated by tabs or spaces but not by colons or any other delimiter.
Now execute command gnuplot and go into the gnuplot command line interface. Now from within gnuplot execute
gnuplot> load ‘./mydata.p’
which will draw the following histogram
This approach is very easy because each time I update my performance test results I just need to change the data in my .dat file and after that just execute gnuplot to redraw the graphs.
gnuplot is indeed a damn good tool … you can automate most of the graphing part (even the changing .dat file part – with the help of awk, sed, perl).
This web site is a very good reference : http://t16web.lanl.gov/Kawano/gnuplot/index-e.html