Commit 18196307 authored by Junio C Hamano's avatar Junio C Hamano

Merge branch 'cc/perf-aggregate-sort'

Perf-test update.

* cc/perf-aggregate-sort:
  perf/aggregate: add --sort-by=regression option
  perf/aggregate: add display_dir()
parents d877975e 2e3efd06
......@@ -37,7 +37,7 @@ sub format_times {
}
my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
$codespeed, $subsection, $reponame);
$codespeed, $sortby, $subsection, $reponame);
while (scalar @ARGV) {
my $arg = $ARGV[0];
my $dir;
......@@ -46,6 +46,18 @@ sub format_times {
shift @ARGV;
next;
}
if ($arg =~ /--sort-by(?:=(.*))?/) {
shift @ARGV;
if (defined $1) {
$sortby = $1;
} else {
$sortby = shift @ARGV;
if (! defined $sortby) {
die "'--sort-by' requires an argument";
}
}
next;
}
if ($arg eq "--subsection") {
shift @ARGV;
$subsection = $ARGV[0];
......@@ -147,6 +159,11 @@ sub have_slash {
return 0;
}
sub display_dir {
my ($d) = @_;
return exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d};
}
sub print_default_results {
my %descrs;
my $descrlen = 4; # "Test"
......@@ -168,8 +185,7 @@ sub print_default_results {
my %times;
my @colwidth = ((0)x@dirs);
for my $i (0..$#dirs) {
my $d = $dirs[$i];
my $w = length (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
my $w = length display_dir($dirs[$i]);
$colwidth[$i] = $w if $w > $colwidth[$i];
}
for my $t (@subtests) {
......@@ -188,8 +204,7 @@ sub print_default_results {
printf "%-${descrlen}s", "Test";
for my $i (0..$#dirs) {
my $d = $dirs[$i];
printf " %-$colwidth[$i]s", (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
printf " %-$colwidth[$i]s", display_dir($dirs[$i]);
}
print "\n";
print "-"x$totalwidth, "\n";
......@@ -206,6 +221,49 @@ sub print_default_results {
}
}
sub print_sorted_results {
my ($sortby) = @_;
if ($sortby ne "regression") {
die "only 'regression' is supported as '--sort-by' argument";
}
my @evolutions;
for my $t (@subtests) {
my ($prevr, $prevu, $prevs, $prevrev);
for my $i (0..$#dirs) {
my $d = $dirs[$i];
my ($r, $u, $s) = get_times("$resultsdir/$prefixes{$d}$t.times");
if ($i > 0 and defined $r and defined $prevr and $prevr > 0) {
my $percent = 100.0 * ($r - $prevr) / $prevr;
push @evolutions, { "percent" => $percent,
"test" => $t,
"prevrev" => $prevrev,
"rev" => $d,
"prevr" => $prevr,
"r" => $r,
"prevu" => $prevu,
"u" => $u,
"prevs" => $prevs,
"s" => $s};
}
($prevr, $prevu, $prevs, $prevrev) = ($r, $u, $s, $d);
}
}
my @sorted_evolutions = sort { $b->{percent} <=> $a->{percent} } @evolutions;
for my $e (@sorted_evolutions) {
printf "%+.1f%%", $e->{percent};
print " " . $e->{test};
print " " . format_times($e->{prevr}, $e->{prevu}, $e->{prevs});
print " " . format_times($e->{r}, $e->{u}, $e->{s});
print " " . display_dir($e->{prevrev});
print " " . display_dir($e->{rev});
print "\n";
}
}
sub print_codespeed_results {
my ($subsection) = @_;
......@@ -260,6 +318,8 @@ sub print_codespeed_results {
if ($codespeed) {
print_codespeed_results($subsection);
} elsif (defined $sortby) {
print_sorted_results($sortby);
} else {
print_default_results();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment