Skip to content

Commit c94b6ac

Browse files
chriscoolgitster
authored andcommitted
perf/aggregate: add display_dir()
This new helper function will be reused in a subsequent commit. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 90bbd50 commit c94b6ac

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

t/perf/aggregate.perl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ sub have_slash {
147147
return 0;
148148
}
149149

150+
sub display_dir {
151+
my ($d) = @_;
152+
return exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d};
153+
}
154+
150155
sub print_default_results {
151156
my %descrs;
152157
my $descrlen = 4; # "Test"
@@ -168,8 +173,7 @@ sub print_default_results {
168173
my %times;
169174
my @colwidth = ((0)x@dirs);
170175
for my $i (0..$#dirs) {
171-
my $d = $dirs[$i];
172-
my $w = length (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
176+
my $w = length display_dir($dirs[$i]);
173177
$colwidth[$i] = $w if $w > $colwidth[$i];
174178
}
175179
for my $t (@subtests) {
@@ -188,8 +192,7 @@ sub print_default_results {
188192

189193
printf "%-${descrlen}s", "Test";
190194
for my $i (0..$#dirs) {
191-
my $d = $dirs[$i];
192-
printf " %-$colwidth[$i]s", (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
195+
printf " %-$colwidth[$i]s", display_dir($dirs[$i]);
193196
}
194197
print "\n";
195198
print "-"x$totalwidth, "\n";

0 commit comments

Comments
 (0)