{"thread":{"id":"47705","subject":"[PATCH 1/3] perf/aggregate: add --subsection option","startedAt":"2018-01-28T11:19:17Z","lastAt":"2018-01-29T07:34:48Z","messageCount":6,"participants":["Christian Couder","Philip Oakley","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"337601","messageId":"20180128111843.2690-1-chriscool@tuxfamily.org","threadId":"47705","inReplyTo":null,"subject":"[PATCH 1/3] perf/aggregate: add --subsection option","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-01-28T11:18:41Z","receivedAt":"2018-01-28T11:19: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\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":"337602","messageId":"20180128111843.2690-2-chriscool@tuxfamily.org","threadId":"47705","inReplyTo":"20180128111843.2690-1-chriscool@tuxfamily.org","subject":"[PATCH 2/3] perf/aggregate: add --reponame option","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-01-28T11:18:42Z","receivedAt":"2018-01-28T11:19:20Z","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\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/perf/aggregate.perl | 31 +++++++++++++++++++++----------\n 1 file changed, 21 insertions(+), 10 deletions(-)\n\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex bbf0f30898..d616d31ca8 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@@ -209,15 +218,17 @@ sub print_codespeed_results {\n \t\t$executable .= \", \" . $subsection;\n \t}\n \n-\tmy $environment;\n-\tif (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-\t\t$environment =~ s|/bin-wrappers$||;\n-\t} else {\n-\t\t$environment = `uname -r`;\n-\t\tchomp $environment;\n+\tmy $environment = $reponame;\n+\tif (! $environment) {\n+\t\tif (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne \"\") {\n+\t\t\t$environment = $ENV{GIT_PERF_REPO_NAME};\n+\t\t} elsif (exists $ENV{GIT_TEST_INSTALLED} and $ENV{GIT_TEST_INSTALLED} ne \"\") {\n+\t\t\t$environment = $ENV{GIT_TEST_INSTALLED};\n+\t\t\t$environment =~ s|/bin-wrappers$||;\n+\t\t} else {\n+\t\t\t$environment = `uname -r`;\n+\t\t\tchomp $environment;\n+\t\t}\n \t}\n \n \tmy @data;\n-- \n2.16.0.rc2.45.g09a1bbd803\n\n"},{"id":"337603","messageId":"20180128111843.2690-3-chriscool@tuxfamily.org","threadId":"47705","inReplyTo":"20180128111843.2690-1-chriscool@tuxfamily.org","subject":"[PATCH 3/3] perf/aggregate: sort JSON fields in output","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-01-28T11:18:43Z","receivedAt":"2018-01-28T11:19:22Z","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 preivous\none when the fields are sorted.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n t/perf/aggregate.perl | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\nindex d616d31ca8..fcc0313e65 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":"337604","messageId":"752336D49C8F4FBE9D77E73330CF4C44@PhilipOakley","threadId":"47705","inReplyTo":"20180128111843.2690-3-chriscool@tuxfamily.org","subject":"Re: [PATCH 3/3] perf/aggregate: sort JSON fields in output","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2018-01-28T12:14:55Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Christian Couder\" <christian.couder@gmail.com>\n> It is much easier to diff the output against a preivous\n\ns/preivous/previous/\n\n> one when the fields are sorted.\n> \n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> ---\n> t/perf/aggregate.perl | 2 +-\n> 1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\n> index d616d31ca8..fcc0313e65 100755\n> --- a/t/perf/aggregate.perl\n> +++ b/t/perf/aggregate.perl\n> @@ -253,7 +253,7 @@ sub print_codespeed_results {\n>  }\n>  }\n> \n> - print to_json(\\@data, {utf8 => 1, pretty => 1}), \"\\n\";\n> + print to_json(\\@data, {utf8 => 1, pretty => 1, canonical => 1}), \"\\n\";\n> }\n> \n> binmode STDOUT, \":utf8\" or die \"PANIC on binmode: $!\";\n> -- \n> 2.16.0.rc2.45.g09a1bbd803\n>\n"},{"id":"337632","messageId":"CAPig+cR77RTTw3uJAwK3XmmvzE7umv3_7M=NkaDEb=uXyNL4FA@mail.gmail.com","threadId":"47705","inReplyTo":"20180128111843.2690-2-chriscool@tuxfamily.org","subject":"Re: [PATCH 2/3] perf/aggregate: add --reponame option","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-01-28T19:57:05Z","receivedAt":"2018-01-28T19:57:10Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Jan 28, 2018 at 6:18 AM, Christian Couder\n<christian.couder@gmail.com> wrote:\n> This makes it easier to use the aggregate script\n> on the command line when one wants to get the\n> \"environment\" fields set in the codespeed output.\n>\n> Previously setting GIT_REPO_NAME was needed\n> for this purpose.\n>\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n> ---\n> diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl\n> @@ -209,15 +218,17 @@ sub print_codespeed_results {\n> -       my $environment;\n> -       if (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne \"\") {\n> -               $environment = $ENV{GIT_PERF_REPO_NAME};\n> -       } elsif (exists $ENV{GIT_TEST_INSTALLED} and $ENV{GIT_TEST_INSTALLED} ne \"\") {\n> -               $environment = $ENV{GIT_TEST_INSTALLED};\n> -               $environment =~ s|/bin-wrappers$||;\n> -       } else {\n> -               $environment = `uname -r`;\n> -               chomp $environment;\n> +       my $environment = $reponame;\n> +       if (! $environment) {\n> +               if (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne \"\") {\n> +                       $environment = $ENV{GIT_PERF_REPO_NAME};\n> +               } elsif (exists $ENV{GIT_TEST_INSTALLED} and $ENV{GIT_TEST_INSTALLED} ne \"\") {\n> +                       $environment = $ENV{GIT_TEST_INSTALLED};\n> +                       $environment =~ s|/bin-wrappers$||;\n> +               } else {\n> +                       $environment = `uname -r`;\n> +                       chomp $environment;\n> +               }\n>         }\n\nNot a big deal, but the extra indentation (and noisy diff) could be\navoided like this:\n\n    my $environment;\n    if ($reponame) {\n        $environment = $reponame;\n    } else if (exists ...) {\n        ...as before....\n    }\n"},{"id":"337651","messageId":"CAP8UFD3-sTC+eknu2Vfjx+QX7j3AeDaqMMi8L2LQPuSCn3L7Jw@mail.gmail.com","threadId":"47705","inReplyTo":"CAPig+cR77RTTw3uJAwK3XmmvzE7umv3_7M=NkaDEb=uXyNL4FA@mail.gmail.com","subject":"Re: [PATCH 2/3] perf/aggregate: add --reponame option","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2018-01-29T07:34:43Z","receivedAt":"2018-01-29T07:34:48Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, Jan 28, 2018 at 8:57 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n>\n> Not a big deal, but the extra indentation (and noisy diff) could be\n> avoided like this:\n>\n>     my $environment;\n>     if ($reponame) {\n>         $environment = $reponame;\n>     } else if (exists ...) {\n>         ...as before....\n>     }\n\nOk I will reroll with something like this and also the typo fix\nsuggested by Philip.\n\nThanks both.\n"}]}