2 # Extract a histogram, minimum, maximum and average from a file,
3 # filtering by a given RE.
6 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
7 & eval 'exec perl -S $0 $argv:q'
10 # The first three lines above let this script run without specifying the
11 # full path to perl, as long as it is in the user's PATH.
12 # Taken from perlrun man page.
16 $opt_k = 'Latency\[LCL,[A-Z]*\]';
38 $sum2 = $f[1] * $f[1];
48 $sum2 += $f[1] * $f[1];
51 $i = int ($f[1] * $opt_r);
55 print "Latency results for $opt_k:\n";
56 $s2 = $sum2 / ($n - 1) - $sum / $n * $sum / ($n - 1);
58 $sigma = int(sqrt ( $s2 ));
60 print "Error: $sum, $sum2, $n\n";
66 " Avg: ", int($sum / $n),
70 while ( ($key,$value) = each %histo ) {
72 print $t, " ", 100 * $value / $n, "\n";