2 # Draw graphs of HTTP transaction caching from http-stats output
3 # (c) 2003 Martin Mares <mj@ucw.cz>, GPL'ed
9 my $datafile = "gp.tmp";
10 open D, ">$datafile" or die;
13 my @ewma = ( 0, 0, 0, 0 );
20 @colnames = split /\t/;
24 my %row = map { $colnames[$i++] => $_ } split /\t/;
25 my $time = POSIX::strftime("%d-%m-%Y %H:%M:%S", localtime $row{'time'});
26 my $w = $row{'width'};
30 $row{'CacheHit'} / $w,
31 $row{'CacheMiss'} / $w
34 for (my $i=0; $i<=$#r; $i++) {
35 $ewma[$i] = $ew*$ewma[$i] + $eww*$r[$i];
36 print D "\t", $ewma[$i];
43 open GP, "|gnuplot" or die;
48 set title "HTTP Transactions: Cacheability"
50 set ylabel "Transactions/s [EWMA $ew]"
52 set timefmt "%d-%m-%Y %H:%M:%S"
53 set format x "%d/%m\\n%H:%M"
56 plot "$datafile" using 1:3 title "Total", \\
57 "$datafile" using 1:4 title "Not cacheable", \\
58 "$datafile" using 1:5 title "Cache hits", \\
59 "$datafile" using 1:6 title "Cache misses"