git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/2] perf/aggregate: add display_dir()

From
Christian Couder <christian.couder@gmail.com>
Date
Mar 26, 2018, 07:24 UTC
Message-ID
<20180326072431.30771-2-chriscool@tuxfamily.org>
In-Reply-To
<20180326072431.30771-1-chriscool@tuxfamily.org>

This new helper function will be reused in a subsequent commit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 t/perf/aggregate.perl | 11 +++++++----
 1 file 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";
-- 
2.17.0.rc1.36.g098d832c9.dirty
Previous: Christian CouderNext: Christian Couder
Message 2 of 3 in “perf/aggregate: sort results by regression”
  1. 0/2 perf/aggregate: sort results by regressionChristian Couder, Mar 26, 2018
  2. 1/2 perf/aggregate: add display_dir()Christian Couder, Mar 26, 2018
  3. 2/2 perf/aggregate: add --sort-by=regression optionChristian Couder, Mar 26, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.