I am running some benchmarking against a website I'm building and would like to produce graphs of the response times. Here's my ApacheBench usage:
> ab -n 100 -c 10 -g foo.tsv http://foo/
This gives me a TSV file with data like so:
starttime seconds ctime dtime ttime wait
Tue Dec 03 16:24:53 2013 1386087893 2 413 415 367
Tue Dec 03 16:24:49 2013 1386087889 1 468 469 452
Tue Dec 03 16:24:54 2013 1386087894 9 479 488 446
Tue Dec 03 16:24:49 2013 1386087889 1 497 498 437
Tue Dec 03 16:24:54 2013 1386087894 33 465 498 458
Tue Dec 03 16:24:53 2013 1386087893 1 507 508 506
Tue Dec 03 16:24:51 2013 1386087891 0 544 544 512
I'd like to convert this data to a histogram with quantity on the Y axis and response time (ttime) on the X axis.
My plot script is below but all I'm getting is an empty (zero byte) jpeg file.
clear
reset
set output "out.jpg"
# Select histogram data
set style data histogram
set style fill solid border
plot 'foo.tsv' using 5
exit
How can I generate this histogram?
Bonus question. I realise this data might lead to many data points with one or two hits, so how can I round the ttime to, say, the nearest 10ms to give me fewer data points with more hits each?
Several things:
If you want to output a
jpg
file, you must useset terminal jpeg
first. But in any case I would suggest you to use thepngcairo
terminal, if you need a bitmap image.The
tsv
uses tabs as column separator. By default gnuplot uses any white space character as separator, in which case the fifth column is always2013
. So useset datafile separator '\t'
.In order to have some binning, you must use
smooth frequency
with an appropriate binning function, which bins your x-values. As y-values I use1
, so thatsmooth frequency
just counts up.Possibly you must skip the first line of your data file with
every ::1
.In your case I would use
boxes
plotting style: