{"thread":{"id":"47734","subject":"[PATCH v2 1/3] perf/aggregate: add --subsection option","startedAt":"2018-02-01T10:15:17Z","lastAt":"2018-02-01T10:15:21Z","messageCount":3,"participants":["Christian Couder"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"338011","messageId":"20180201101434.5383-1-chriscool@tuxfamily.org","threadId":"47734","inReplyTo":null,"subject":"[PATCH v2 1/3] perf/aggregate: add --subsection option","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-02-01T10:14:32Z","receivedAt":"2018-02-01T10:15:17Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This makes it easier to use the aggregate script\non the command line, to get results from\nsubsections.\n\nPreviously setting GIT_PERF_SUBSECTION was needed\nfor this purpose.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/perf/aggregate.perl | 33 ++++++++++++++++++++++++---------\n 1 file changed, 24 insertions(+), 9 deletions(-)\n\nThis small patch series contains a few small Codespeed related\nusability improvements of the perf/aggregate.perl script on top the\ncc/codespeed patch series that was recently merged into master.\n\nChanges compared to v1 are described in each patch if any.\n\nThe discussion thread about v1 is there:  \n\nhttps://public-inbox.org/git/20180128111843.2690-1-chriscool@tuxfamily.org/T/#u\n\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex 5c439f6bc2..bbf0f30898 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -36,7 +36,8 @@ sub format_times {\n \treturn $out;\n }\n \n-my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests, $codespeed);\n+my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,\n+    $codespeed, $subsection);\n while (scalar @ARGV) {\n \tmy $arg = $ARGV[0];\n \tmy $dir;\n@@ -45,6 +46,15 @@ while (scalar @ARGV) {\n \t\tshift @ARGV;\n \t\tnext;\n \t}\n+\tif ($arg eq \"--subsection\") {\n+\t\tshift @ARGV;\n+\t\t$subsection = $ARGV[0];\n+\t\tshift @ARGV;\n+\t\tif (! $subsection) {\n+\t\t\tdie \"empty subsection\";\n+\t\t}\n+\t\tnext;\n+\t}\n \tlast if -f $arg or $arg eq \"--\";\n \tif (! -d $arg) {\n \t\tmy $rev = Git::command_oneline(qw(rev-parse --verify), $arg);\n@@ -76,10 +86,15 @@ if (not @tests) {\n }\n \n my $resultsdir = \"test-results\";\n-my $results_section = \"\";\n-if (exists $ENV{GIT_PERF_SUBSECTION} and $ENV{GIT_PERF_SUBSECTION} ne \"\") {\n-\t$resultsdir .= \"/\" . $ENV{GIT_PERF_SUBSECTION};\n-\t$results_section = $ENV{GIT_PERF_SUBSECTION};\n+\n+if (! $subsection and\n+    exists $ENV{GIT_PERF_SUBSECTION} and\n+    $ENV{GIT_PERF_SUBSECTION} ne \"\") {\n+\t$subsection = $ENV{GIT_PERF_SUBSECTION};\n+}\n+\n+if ($subsection) {\n+\t$resultsdir .= \"/\" . $subsection;\n }\n \n my @subtests;\n@@ -183,15 +198,15 @@ sub print_default_results {\n }\n \n sub print_codespeed_results {\n-\tmy ($results_section) = @_;\n+\tmy ($subsection) = @_;\n \n \tmy $project = \"Git\";\n \n \tmy $executable = `uname -s -m`;\n \tchomp $executable;\n \n-\tif ($results_section ne \"\") {\n-\t\t$executable .= \", \" . $results_section;\n+\tif ($subsection) {\n+\t\t$executable .= \", \" . $subsection;\n \t}\n \n \tmy $environment;\n@@ -233,7 +248,7 @@ sub print_codespeed_results {\n binmode STDOUT, \":utf8\" or die \"PANIC on binmode: $!\";\n \n if ($codespeed) {\n-\tprint_codespeed_results($results_section);\n+\tprint_codespeed_results($subsection);\n } else {\n \tprint_default_results();\n }\n-- \n2.16.0.rc2.45.g09a1bbd803\n\n"},{"id":"338012","messageId":"20180201101434.5383-3-chriscool@tuxfamily.org","threadId":"47734","inReplyTo":"20180201101434.5383-1-chriscool@tuxfamily.org","subject":"[PATCH v2 3/3] perf/aggregate: sort JSON fields in output","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-02-01T10:14:34Z","receivedAt":"2018-02-01T10:15:19Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"It is much easier to diff the output against a previous\none when the fields are sorted.\n\nHelped-by: Philip Oakley <philipoakley@iee.org>\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/perf/aggregate.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\nThe only change compared to v1 is a typo fix suggested by Philip in\nthe commti message.\n\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex a609292491..749d6689f9 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -253,7 +253,7 @@ sub print_codespeed_results {\n \t\t}\n \t}\n \n-\tprint to_json(\\@data, {utf8 => 1, pretty => 1}), \"\\n\";\n+\tprint to_json(\\@data, {utf8 => 1, pretty => 1, canonical => 1}), \"\\n\";\n }\n \n binmode STDOUT, \":utf8\" or die \"PANIC on binmode: $!\";\n-- \n2.16.0.rc2.45.g09a1bbd803\n\n"},{"id":"338013","messageId":"20180201101434.5383-2-chriscool@tuxfamily.org","threadId":"47734","inReplyTo":"20180201101434.5383-1-chriscool@tuxfamily.org","subject":"[PATCH v2 2/3] perf/aggregate: add --reponame option","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-02-01T10:14:33Z","receivedAt":"2018-02-01T10:15:21Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This makes it easier to use the aggregate script\non the command line when one wants to get the\n\"environment\" fields set in the codespeed output.\n\nPreviously setting GIT_REPO_NAME was needed\nfor this purpose.\n\nHelped-by: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/perf/aggregate.perl | 15 +++++++++++++--\n 1 file changed, 13 insertions(+), 2 deletions(-)\n\nThe only change compared to v1 is a logical change suggested by Eric\nin the 'if ... elsif ... else ...' sequence that sets $environment.\n\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex bbf0f30898..a609292491 100755\n--- a/t/perf/aggregate.perl\n+++ b/t/perf/aggregate.perl\n@@ -37,7 +37,7 @@ sub format_times {\n }\n \n my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,\n-    $codespeed, $subsection);\n+    $codespeed, $subsection, $reponame);\n while (scalar @ARGV) {\n \tmy $arg = $ARGV[0];\n \tmy $dir;\n@@ -55,6 +55,15 @@ while (scalar @ARGV) {\n \t\t}\n \t\tnext;\n \t}\n+\tif ($arg eq \"--reponame\") {\n+\t\tshift @ARGV;\n+\t\t$reponame = $ARGV[0];\n+\t\tshift @ARGV;\n+\t\tif (! $reponame) {\n+\t\t\tdie \"empty reponame\";\n+\t\t}\n+\t\tnext;\n+\t}\n \tlast if -f $arg or $arg eq \"--\";\n \tif (! -d $arg) {\n \t\tmy $rev = Git::command_oneline(qw(rev-parse --verify), $arg);\n@@ -210,7 +219,9 @@ sub print_codespeed_results {\n \t}\n \n \tmy $environment;\n-\tif (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne \"\") {\n+\tif ($reponame) {\n+\t\t$environment = $reponame;\n+\t} elsif (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne \"\") {\n \t\t$environment = $ENV{GIT_PERF_REPO_NAME};\n \t} elsif (exists $ENV{GIT_TEST_INSTALLED} and $ENV{GIT_TEST_INSTALLED} ne \"\") {\n \t\t$environment = $ENV{GIT_TEST_INSTALLED};\n-- \n2.16.0.rc2.45.g09a1bbd803\n\n"}]}