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 <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Feb 1, 2018 at 11:14 UTC
cd5d4bf609339dec94ee64fce4bac4468e5277fc
1 file changed
+24
-9
t/perf/aggregate.perl
+24
-9
@@ -36,7 +36,8 @@ sub format_times {
36
return $out;
37
}
38
39
-my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests, $codespeed);
39
+my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
40
+ $codespeed, $subsection);
41
while (scalar @ARGV) {
42
my $arg = $ARGV[0];
43
my $dir;
@@ -45,6 +46,15 @@ while (scalar @ARGV) {
46
shift @ARGV;
47
next;
48
}
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
+ }
58
last if -f $arg or $arg eq "--";
59
if (! -d $arg) {
60
my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
@@ -76,10 +86,15 @@ if (not @tests) {
86
}
87
88
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;
98
}
99
100
my @subtests;
@@ -183,15 +198,15 @@ sub print_default_results {
198
}
199
200
sub print_codespeed_results {
186
- my ($results_section) = @_;
201
+ my ($subsection) = @_;
202
203
my $project = "Git";
204
205
my $executable = `uname -s -m`;
206
chomp $executable;
207
193
- if ($results_section ne "") {
194
- $executable .= ", " . $results_section;
208
+ if ($subsection) {
209
+ $executable .= ", " . $subsection;
210
}
211
212
my $environment;
@@ -233,7 +248,7 @@ sub print_codespeed_results {
248
binmode STDOUT, ":utf8" or die "PANIC on binmode: $!";
249
250
if ($codespeed) {
236
- print_codespeed_results($results_section);
251
+ print_codespeed_results($subsection);
252
} else {
253
print_default_results();
254
}