-
Notifications
You must be signed in to change notification settings - Fork 1
/
summarize.pl
executable file
·43 lines (37 loc) · 1.01 KB
/
summarize.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl -lw
use strict;
use Getopt::Long;
my %timeFor;
my $byPRNG;
my $byMethod;
my $byCompiler;
my $bySeed;
GetOptions ("method" => \$byMethod,
"prng" => \$byPRNG,
"compiler" => \$byCompiler,
"seed" => \$bySeed)
or die("Error in command line arguments\n");
foreach my $file (@ARGV) {
my $id = $file;
$id =~ s{\.([^.]+)\.([^.]+)\.([^.]+)\.([^.]+)\.}{
($byMethod ? ".$1" : "") . ($byPRNG ? ".$2" : "") .
($byCompiler ? ".$3" : "") . ($bySeed ? ".$4" : "") . "."}e;
$id =~ s{.*/}{};
$id =~ s{\.out}{};
open my $fh, "<", $file or die "$!";
while (<$fh>) {
chomp;
next unless m{^(.*?) completed \((\S+) seconds\)};
push @{$timeFor{$id}{$1}}, $2;
}
}
foreach my $id (sort keys %timeFor) {
my @cols;
foreach my $kind (sort keys %{$timeFor{$id}}) {
my $sum = 0;
$sum += log $_ foreach @{$timeFor{$id}{$kind}};
my $avg = $sum/@{$timeFor{$id}{$kind}};
push @cols, exp $avg;
}
print join("\t", $id, @cols);
}