2 # Calculate statistics of HTTP transactions from netgrind output
3 # (c) 2003 Martin Mares <mj@ucw.cz>, GPL'ed
9 print "# time width Total TCPErr Nocache CacheHit CacheMiss LenTotal NTimings TimeTotal TimeTMin TimeTMax TimeWait TimeWMin TimeWMax NGETs NPOSTs\n";
15 my ($t1, $t2, $src, $dst, $ffor, $result, $cache, $queue, $length, $totaltime, $waittime, $ctype, $method, $url) = split /\s+/;
16 my ($tY, $tm, $td) = split (/-/, $t1);
17 my ($tH, $tM, $tS) = split (/:/, $t2);
18 my $tt = POSIX::mktime($tS, $tM, $tH, $td, $tm-1, $tY-1900);
19 $tt -= $tt % $histogran;
22 $h = [ $histogran, 0, 0, 0, 0, 0, 0, 0, 0, 1000000000, 0, 0, 1000000000, 0, 0, 0 ];
26 $h->[2]++ if $result =~ /^[TC]/;
27 $h->[3]++ if $cache =~ /^((N..)|(.[NP].))$/;
28 $h->[4]++ if $cache =~ /\+$/;
29 $h->[5]++ if $cache =~ /-$/;
31 if ($result =~ /^\d+$/) {
34 $h->[9]=$totaltime if $h->[9] > $totaltime;
35 $h->[10]=$totaltime if $h->[9] < $totaltime;
37 $h->[12]=$waittime if $h->[12] > $waittime;
38 $h->[13]=$waittime if $h->[12] < $waittime;
40 $h->[14]++ if $method eq "GET";
41 $h->[15]++ if $method eq "POST";
43 foreach my $x (sort keys %hist) {
44 print "$x\t", join("\t", @{$hist{$x}}), "\n";