2 # Draw graphs of HTTP transaction delays from http-stats output
3 # (c) 2003 Martin Mares <mj@ucw.cz>, GPL'ed
9 my $maxs = (@ARGV >= 1 && $ARGV[0] eq "--max");
11 my $datafile = "gp.tmp";
12 open D, ">$datafile" or die;
15 my @ewma = ( 0, 0, 0, 0, 0, 0 );
22 @colnames = split /\t/;
26 my %row = map { $colnames[$i++] => $_ } split /\t/;
27 my $time = POSIX::strftime("%d-%m-%Y %H:%M:%S", localtime $row{'time'});
28 my $n = $row{'NTimings'};
32 $row{'TimeTotal'} / $n,
35 $row{'TimeWait'} / $n,
40 @r = ( 0, 0, 0, 0, 0, 0 );
43 for (my $i=0; $i<=$#r; $i++) {
44 $ewma[$i] = $ew*$ewma[$i] + $eww*$r[$i];
45 print D "\t", $ewma[$i];
52 my $ct = $maxs ? "Maximum" : "Average";
53 my $c1 = $maxs ? 5 : 3;
54 my $c2 = $maxs ? 8 : 6;
56 open GP, "|gnuplot" or die;
61 set title "HTTP Transactions: $ct Timings"
63 set ylabel "seconds [EWMA $ew]"
65 set timefmt "%d-%m-%Y %H:%M:%S"
66 set format x "%d/%m\\n%H:%M"
69 plot "$datafile" using 1:$c1 title "Total time", \\
70 "$datafile" using 1:$c2 title "Reply delay"