Skip to content

Commit cd5d4bf

Browse files
chriscoolgitster
authored andcommitted
perf/aggregate: add --subsection option
This makes it easier to use the aggregate script on the command line, to get results from subsections. Previously setting GIT_PERF_SUBSECTION was needed for this purpose. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5be1f00 commit cd5d4bf

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

t/perf/aggregate.perl

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ sub format_times {
3636
return $out;
3737
}
3838

39-
my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests, $codespeed);
39+
my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
40+
$codespeed, $subsection);
4041
while (scalar @ARGV) {
4142
my $arg = $ARGV[0];
4243
my $dir;
@@ -45,6 +46,15 @@ sub format_times {
4546
shift @ARGV;
4647
next;
4748
}
49+
if ($arg eq "--subsection") {
50+
shift @ARGV;
51+
$subsection = $ARGV[0];
52+
shift @ARGV;
53+
if (! $subsection) {
54+
die "empty subsection";
55+
}
56+
next;
57+
}
4858
last if -f $arg or $arg eq "--";
4959
if (! -d $arg) {
5060
my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
@@ -76,10 +86,15 @@ sub format_times {
7686
}
7787

7888
my $resultsdir = "test-results";
79-
my $results_section = "";
80-
if (exists $ENV{GIT_PERF_SUBSECTION} and $ENV{GIT_PERF_SUBSECTION} ne "") {
81-
$resultsdir .= "/" . $ENV{GIT_PERF_SUBSECTION};
82-
$results_section = $ENV{GIT_PERF_SUBSECTION};
89+
90+
if (! $subsection and
91+
exists $ENV{GIT_PERF_SUBSECTION} and
92+
$ENV{GIT_PERF_SUBSECTION} ne "") {
93+
$subsection = $ENV{GIT_PERF_SUBSECTION};
94+
}
95+
96+
if ($subsection) {
97+
$resultsdir .= "/" . $subsection;
8398
}
8499

85100
my @subtests;
@@ -183,15 +198,15 @@ sub print_default_results {
183198
}
184199

185200
sub print_codespeed_results {
186-
my ($results_section) = @_;
201+
my ($subsection) = @_;
187202

188203
my $project = "Git";
189204

190205
my $executable = `uname -s -m`;
191206
chomp $executable;
192207

193-
if ($results_section ne "") {
194-
$executable .= ", " . $results_section;
208+
if ($subsection) {
209+
$executable .= ", " . $subsection;
195210
}
196211

197212
my $environment;
@@ -233,7 +248,7 @@ sub print_codespeed_results {
233248
binmode STDOUT, ":utf8" or die "PANIC on binmode: $!";
234249

235250
if ($codespeed) {
236-
print_codespeed_results($results_section);
251+
print_codespeed_results($subsection);
237252
} else {
238253
print_default_results();
239254
}

0 commit comments

Comments
 (0)