#!/usr/bin/perl -w
use strict;
my $BUCKET = 5;
sub bynum {
return $a <=> $b;
}
my %hist;
my $over_1;
my $over_5;
my $over_10;
my $over_50;
my $worst;
sub read_file ($) {
my $fn = shift;
open INF, "<$fn" or die;
while (my $line = <INF>) {
chomp $line;
if ($line =~ /^latlate: ([\-0-9\.]+)$/) {
my $late = $1;
if ($late > 1000) {
$over_1++;
}
if ($late > $worst) {
$worst = $late;
}
if ($late > 5000) {
$over_5++;
}
if ($late > 10000) {
$over_10++;
}
if ($late > 50000) {
$over_50++;
}
my $bucket = $BUCKET * int ($late/$BUCKET);
#print "$bucket ";
$hist{$bucket}++;
} else {
#print "non matching line: $line\n";
}
}
close INF;
}
sub do_kern ($) {
my $kern = shift;
%hist = ();
$over_1 = 0;
$over_5 = 0;
$over_10 = 0;
$over_50 = 0;
$worst = 0;
for (my $i=1; $i<=3; $i++) {
read_file ("latency_".$kern."_$i.out");
}
my $total = 0;
foreach (sort bynum keys %hist) {
#print "$_ $hist{$_}\n";
$total += $hist{$_};
}
print "$kern :\n";
print " total $total\n";
print " worst $worst\n";
print " $over_1 over 1ms\n";
print " $over_5 over 5ms\n";
print " $over_10 over 10ms\n";
print " $over_50 over 50ms\n";
print " $kern& $over_1& $over_5& $over_10& $over_50\\\\\n";
}
do_kern ("2407timesys");
do_kern ("2214redhat");
do_kern ("2417rml");
do_kern ("2417vanilla");
syntax highlighted by Code2HTML, v. 0.9.1