3 use lib
'../../perl/blib/lib';
10 open my $fh, "<", $name or return undef;
12 return undef if not defined $line;
13 close $fh or die "cannot close $name: $!";
14 $line =~ /^(?:(\d+):)?(\d+):(\d+(?:\.\d+)?) (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)$/
15 or die "bad input line: $line";
16 my $rt = ((defined $1 ?
$1 : 0.0)*60+$2)*60+$3;
21 my ($r, $u, $s, $firstr) = @_;
25 my $out = sprintf "%.2f(%.2f+%.2f)", $r, $u, $s;
26 if (defined $firstr) {
28 $out .= sprintf " %+.1f%%", 100.0*($r-$firstr)/$firstr;
38 my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests);
39 while (scalar @ARGV) {
42 last if -f
$arg or $arg eq "--";
44 my $rev = Git
::command_oneline
(qw(rev-parse --verify), $arg);
49 $dirabbrevs{$dir} = $dir;
52 $dirnames{$dir} = $arg;
54 $prefix =~ tr/^a-zA-Z0-9/_/c;
55 $prefixes{$dir} = $prefix . '.';
62 $dirnames{'.'} = $dirabbrevs{'.'} = "this tree";
65 shift @ARGV if scalar @ARGV and $ARGV[0] eq "--";
69 @tests = glob "p????-*.sh";
72 my $resultsdir = "test-results";
73 if ($ENV{GIT_PERF_SUBSECTION
} ne "") {
74 $resultsdir .= "/" . $ENV{GIT_PERF_SUBSECTION
};
80 $t =~ s{(?:.*/)?(p(\d+)-[^/]+)\.sh$}{$1} or die "bad test name: $t";
82 my $fname = "$resultsdir/$t.subtests";
83 open my $fp, "<", $fname or die "cannot open $fname: $!";
86 /^(\d+)$/ or die "malformed subtest line: $_";
87 push @subtests, "$t.$1";
88 $shorttests{"$t.$1"} = "$n.$1";
90 close $fp or die "cannot close $fname: $!";
95 open my $fh, "<", $name or return "<error reading description>";
96 binmode $fh, ":utf8" or die "PANIC on binmode: $!";
98 close $fh or die "cannot close $name";
104 my $descrlen = 4; # "Test"
105 for my $t (@subtests) {
106 $descrs{$t} = $shorttests{$t}.": ".read_descr
("$resultsdir/$t.descr");
107 $descrlen = length $descrs{$t} if length $descrs{$t}>$descrlen;
113 return 1 if exists $seen{$_};
125 my %newdirabbrevs = %dirabbrevs;
126 while (!have_duplicate
(values %newdirabbrevs)) {
127 %dirabbrevs = %newdirabbrevs;
128 last if !have_slash
(values %dirabbrevs);
129 %newdirabbrevs = %dirabbrevs;
130 for (values %newdirabbrevs) {
136 my @colwidth = ((0)x
@dirs);
137 for my $i (0..$#dirs) {
139 my $w = length (exists $dirabbrevs{$d} ?
$dirabbrevs{$d} : $dirnames{$d});
140 $colwidth[$i] = $w if $w > $colwidth[$i];
142 for my $t (@subtests) {
144 for my $i (0..$#dirs) {
146 $times{$prefixes{$d}.$t} = [get_times
("$resultsdir/$prefixes{$d}$t.times")];
147 my ($r,$u,$s) = @
{$times{$prefixes{$d}.$t}};
148 my $w = length format_times
($r,$u,$s,$firstr);
149 $colwidth[$i] = $w if $w > $colwidth[$i];
150 $firstr = $r unless defined $firstr;
153 my $totalwidth = 3*@dirs+$descrlen;
154 $totalwidth += $_ for (@colwidth);
156 binmode STDOUT
, ":utf8" or die "PANIC on binmode: $!";
158 printf "%-${descrlen}s", "Test";
159 for my $i (0..$#dirs) {
161 printf " %-$colwidth[$i]s", (exists $dirabbrevs{$d} ?
$dirabbrevs{$d} : $dirnames{$d});
164 print "-"x
$totalwidth, "\n";
165 for my $t (@subtests) {
166 printf "%-${descrlen}s", $descrs{$t};
168 for my $i (0..$#dirs) {
170 my ($r,$u,$s) = @
{$times{$prefixes{$d}.$t}};
171 printf " %-$colwidth[$i]s", format_times
($r,$u,$s,$firstr);
172 $firstr = $r unless defined $firstr;