2007-11-05 17:21:53 -05:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
2007-11-05 22:49:38 -05:00
|
|
|
sub average {
|
|
|
|
my $n = 0;
|
|
|
|
my $s = 0;
|
|
|
|
$n++, $s+=$_ foreach @_;
|
|
|
|
$s/$n;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub min {
|
|
|
|
my $m = shift;
|
|
|
|
($_ < $m) and $m = $_ foreach @_;
|
|
|
|
$m;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub max {
|
|
|
|
my $m = shift;
|
|
|
|
($_ > $m) and $m = $_ foreach @_;
|
|
|
|
$m;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-11-05 17:21:53 -05:00
|
|
|
my %times;
|
|
|
|
my %benchmarks;
|
|
|
|
my %runtimes;
|
|
|
|
my %gctimes;
|
|
|
|
|
|
|
|
{
|
|
|
|
my $curtime;
|
|
|
|
my $curbench;
|
|
|
|
my $counter = 0;
|
2007-11-05 22:49:38 -05:00
|
|
|
open F, "<timelog" or die;
|
2007-11-05 17:21:53 -05:00
|
|
|
while(<F>){
|
|
|
|
if (/^NOW: (.*)/){
|
|
|
|
$curtime = $1;
|
|
|
|
$times{$curtime} = ++$counter;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
if(/^running stats for (.*):$/){
|
|
|
|
$curbench = $1;
|
|
|
|
$benchmarks{$curbench} ||= ++$counter;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
if(/^ *(\d*) ms elapsed cpu time, including (\d*) ms collecting$/){
|
2007-11-05 22:49:38 -05:00
|
|
|
push @{$runtimes{$curbench}{$curtime}}, $1;
|
|
|
|
push @{$gctimes{$curbench}{$curtime}}, $2;
|
2007-11-05 17:21:53 -05:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close F;
|
|
|
|
}
|
|
|
|
|
|
|
|
my @times = sort { $times{$a} <=> $times{$b} } keys %times;
|
|
|
|
my @benchmarks = sort { $benchmarks{$a} <=> $benchmarks{$b} } keys %benchmarks;
|
|
|
|
|
2007-11-06 01:14:27 -05:00
|
|
|
my $verbose = 0;
|
|
|
|
|
2007-11-05 17:21:53 -05:00
|
|
|
foreach my $bench (@benchmarks){
|
|
|
|
print "benchmark: $bench\n";
|
2007-11-06 01:14:27 -05:00
|
|
|
my $prev = 0;
|
2007-11-05 17:21:53 -05:00
|
|
|
foreach my $time (@times){
|
2007-11-10 06:28:29 -05:00
|
|
|
defined $runtimes{$bench}{$time} or next;
|
2007-11-05 22:49:38 -05:00
|
|
|
my @times = @{$runtimes{$bench}{$time}};
|
2007-11-06 01:14:27 -05:00
|
|
|
my $avg = average(@times);
|
|
|
|
if($prev){
|
|
|
|
my $diff = (($avg - $prev) / $prev) * 100;
|
|
|
|
printf " %6d %6s on $time\n",
|
|
|
|
$avg,
|
|
|
|
sprintf("(%s%d%%)", ($diff>0) ? "+" : ($diff<0) ? "-" : "", abs $diff);
|
|
|
|
} else {
|
|
|
|
printf " %6d on $time\n", $avg;
|
|
|
|
}
|
|
|
|
$prev = $avg;
|
2007-11-05 17:21:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|