summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2018-03-26 09:24:30 +0200
committerJunio C Hamano <gitster@pobox.com>2018-03-27 17:04:06 -0700
commitc94b6ac50f59e49cd080c76a07ea2734798da37d (patch)
tree33918ce06b4dfd1af5c57cbe334ab446ac69891f
parent90bbd502d54fe920356fa9278055dc9c9bfe9a56 (diff)
downloadgit-c94b6ac50f59e49cd080c76a07ea2734798da37d.tar.gz
perf/aggregate: add display_dir()
This new helper function will be reused in a subsequent commit. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/perf/aggregate.perl11
1 files changed, 7 insertions, 4 deletions
diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl
index 821cf1498b..890d85fa7b 100755
--- a/t/perf/aggregate.perl
+++ b/t/perf/aggregate.perl
@@ -147,6 +147,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 +173,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 +192,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";