git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Jonathan Nieder" <jrnieder@gmail.com>,
	"Paul Smith" <paul@mad-scientist.net>,
	git@vger.kernel.org, "Derrick Stolee" <stolee@gmail.com>,
	"Duy Nguyen" <pclouds@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"brian m. carlson" <sandals@crustytoothpaste.net>
Subject: wide t/perf output, was Re: [ANNOUNCE] Git v2.19.0-rc0
Date: Thu, 23 Aug 2018 12:31:30 -0400	[thread overview]
Message-ID: <20180823163130.GC29579@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqa7pdkyn9.fsf@gitster-ct.c.googlers.com>

On Thu, Aug 23, 2018 at 06:20:26AM -0700, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > Here are numbers for p0001.2 run against linux.git on a few
> > versions. This is using -O2 with gcc 8.2.0.
> >
> >   Test     v2.18.0             v2.19.0-rc0               HEAD
> >   ------------------------------------------------------------------------------
> >   0001.2:  34.24(33.81+0.43)   34.83(34.42+0.40) +1.7%   33.90(33.47+0.42) -1.0%
> 
> I see what you did to the formatting here, which is a topic of
> another thread ;-).

Do you happen to have a link? I missed that one, and digging turned up
nothing.

A while ago I wrote the patch below. I don't recall why I never sent it
in (and it doesn't apply cleanly these days, though I'm sure it could be
forward-ported).

-- >8 --
Date: Wed, 20 Jan 2016 23:54:14 -0500
Subject: [PATCH] t/perf: add "tall" output format

When aggregating results, we usually show a list of tests,
one per line, with the tested revisions in columns across.
Like:

    $ ./aggregate.perl 348d4f2^ 348d4f2 p7000-filter-branch.sh
    Test                  348d4f2^               348d4f2
    -------------------------------------------------------------------
    7000.2: noop filter   295.32(269.61+14.36)   7.92(0.85+0.72) -97.3%

This is useful if you have a lot of tests to show, but few
revisions; you're effectively comparing the two items on
each line. But sometimes you have the opposite: few tests,
but a large number of revisions. In this case, the lines
get very long, and it's hard to compare values.

This patch introduces a "tall" format that shows the same
data in a more vertical manner:

    $ ./aggregate.perl --tall \
        348d4f2^ 348d4f2 \
        jk/filter-branch-empty^ \
        jk/filter-branch-empty \
        p7000-filter-branch.sh
    Test: p7000-filter-branch.2
    348d4f2^                  295.32(269.61+14.36)
    348d4f2                        7.92(0.85+0.72) -97.3%
    jk/filter-branch-empty^        9.37(0.87+0.80) -96.8%
    jk/filter-branch-empty         7.71(0.92+0.62) -97.4%

Signed-off-by: Jeff King <peff@peff.net>
---
 t/perf/aggregate.perl | 124 ++++++++++++++++++++++++++++++------------
 1 file changed, 88 insertions(+), 36 deletions(-)

diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl
index e401208488..d108a02ccd 100755
--- a/t/perf/aggregate.perl
+++ b/t/perf/aggregate.perl
@@ -17,29 +17,41 @@ sub get_times {
 	return ($rt, $4, $5);
 }
 
-sub format_times {
+sub format_times_list {
 	my ($r, $u, $s, $firstr) = @_;
 	if (!defined $r) {
 		return "<missing>";
 	}
 	my $out = sprintf "%.2f(%.2f+%.2f)", $r, $u, $s;
+	my $pct;
 	if (defined $firstr) {
 		if ($firstr > 0) {
-			$out .= sprintf " %+.1f%%", 100.0*($r-$firstr)/$firstr;
+			$pct = sprintf "%+.1f%%", 100.0*($r-$firstr)/$firstr;
 		} elsif ($r == 0) {
-			$out .= " =";
+			$pct = "=";
 		} else {
-			$out .= " +inf";
+			$pct = "+inf";
 		}
 	}
-	return $out;
+	return ($out, $pct);
+}
+
+sub format_times {
+	my ($times, $pct) = format_times_list(@_);
+	return defined $pct ? "$times $pct" : $times;
 }
 
 my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests);
+my ($tall_format);
 while (scalar @ARGV) {
 	my $arg = $ARGV[0];
 	my $dir;
 	last if -f $arg or $arg eq "--";
+	if ($arg eq "--tall") {
+		$tall_format = 1;
+		shift @ARGV;
+		next;
+	}
 	if (! -d $arg) {
 		my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
 		$dir = "build/".$rev;
@@ -122,6 +134,11 @@ sub have_slash {
 	return 0;
 }
 
+sub printable_dir {
+	my ($d) = @_;
+	return exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d};
+}
+
 my %newdirabbrevs = %dirabbrevs;
 while (!have_duplicate(values %newdirabbrevs)) {
 	%dirabbrevs = %newdirabbrevs;
@@ -132,44 +149,79 @@ sub have_slash {
 	}
 }
 
-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});
-	$colwidth[$i] = $w if $w > $colwidth[$i];
-}
-for my $t (@subtests) {
-	my $firstr;
+binmode STDOUT, ":utf8" or die "PANIC on binmode: $!";
+
+if (!$tall_format) {
+	my %times;
+	my @colwidth = ((0)x@dirs);
 	for my $i (0..$#dirs) {
 		my $d = $dirs[$i];
-		$times{$prefixes{$d}.$t} = [get_times("$resultsdir/$prefixes{$d}$t.times")];
-		my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
-		my $w = length format_times($r,$u,$s,$firstr);
+		my $w = length(printable_dir($d));
 		$colwidth[$i] = $w if $w > $colwidth[$i];
-		$firstr = $r unless defined $firstr;
 	}
-}
-my $totalwidth = 3*@dirs+$descrlen;
-$totalwidth += $_ for (@colwidth);
-
-binmode STDOUT, ":utf8" or die "PANIC on binmode: $!";
+	for my $t (@subtests) {
+		my $firstr;
+		for my $i (0..$#dirs) {
+			my $d = $dirs[$i];
+			$times{$prefixes{$d}.$t} = [get_times("$resultsdir/$prefixes{$d}$t.times")];
+			my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
+			my $w = length format_times($r,$u,$s,$firstr);
+			$colwidth[$i] = $w if $w > $colwidth[$i];
+			$firstr = $r unless defined $firstr;
+		}
+	}
+	my $totalwidth = 3*@dirs+$descrlen;
+	$totalwidth += $_ for (@colwidth);
 
-printf "%-${descrlen}s", "Test";
-for my $i (0..$#dirs) {
-	my $d = $dirs[$i];
-	printf "   %-$colwidth[$i]s", (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
-}
-print "\n";
-print "-"x$totalwidth, "\n";
-for my $t (@subtests) {
-	printf "%-${descrlen}s", $descrs{$t};
-	my $firstr;
+	printf "%-${descrlen}s", "Test";
 	for my $i (0..$#dirs) {
 		my $d = $dirs[$i];
-		my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
-		printf "   %-$colwidth[$i]s", format_times($r,$u,$s,$firstr);
-		$firstr = $r unless defined $firstr;
+		printf "   %-$colwidth[$i]s", printable_dir($d);
 	}
 	print "\n";
+	print "-"x$totalwidth, "\n";
+	for my $t (@subtests) {
+		printf "%-${descrlen}s", $descrs{$t};
+		my $firstr;
+		for my $i (0..$#dirs) {
+			my $d = $dirs[$i];
+			my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
+			printf "   %-$colwidth[$i]s", format_times($r,$u,$s,$firstr);
+			$firstr = $r unless defined $firstr;
+		}
+		print "\n";
+	}
+} else {
+	my $shown = 0;
+	for my $t (@subtests) {
+		print "\n" if $shown++;
+		print "Test: $t\n";
+
+		my %times;
+		my $firstr;
+		for my $d (@dirs) {
+			my ($r, $u, $s) = get_times("test-results/$prefixes{$d}$t.times");
+			$times{$d} = [format_times_list($r, $u, $s, $firstr)];
+			$firstr = $r unless defined $firstr;
+		}
+
+		my $maxdirlen = 0;
+		my $maxtimelen = 0;
+		for my $d (@dirs) {
+			if (length($d) > $maxdirlen) {
+				$maxdirlen = length(printable_dir($d));
+			}
+			if (length($times{$d}->[0]) > $maxtimelen) {
+				$maxtimelen = length($times{$d}->[0]);
+			}
+		}
+		$maxdirlen++;
+
+		for my $d (@dirs) {
+			printf "%-${maxdirlen}s", printable_dir($d);
+			printf "   %${maxtimelen}s", $times{$d}->[0];
+			print " $times{$d}->[1]" if defined $times{$d}->[1];
+			print "\n";
+		}
+	}
 }
-- 
2.19.0.rc0.412.g7005db4e88


  reply	other threads:[~2018-08-23 16:31 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20 22:13 [ANNOUNCE] Git v2.19.0-rc0 Junio C Hamano
2018-08-20 22:41 ` Stefan Beller
2018-08-20 23:39   ` Jonathan Nieder
2018-08-21  0:27     ` Jonathan Nieder
2018-08-21  0:46       ` Stefan Beller
2018-08-21 20:41 ` Derrick Stolee
2018-08-21 21:29   ` Jeff King
2018-08-22  0:48     ` brian m. carlson
2018-08-22  3:03       ` Jeff King
2018-08-22  3:36         ` Jeff King
2018-08-22 11:11           ` Derrick Stolee
2018-08-22  5:36         ` brian m. carlson
2018-08-22  6:07           ` Jeff King
2018-08-22  7:39             ` Ævar Arnfjörð Bjarmason
2018-08-22 11:14               ` Derrick Stolee
2018-08-22 15:17                 ` Jeff King
2018-08-22 16:08                   ` Duy Nguyen
2018-08-22 16:14                     ` Duy Nguyen
2018-08-22 16:26                       ` Jeff King
2018-08-22 16:49                         ` Derrick Stolee
2018-08-22 16:58                           ` Duy Nguyen
2018-08-22 17:04                             ` Derrick Stolee
2018-08-22 16:59                           ` Jeff King
2018-08-22 17:02                             ` Junio C Hamano
2018-08-22 15:14               ` Jeff King
2018-08-22 14:28           ` Derrick Stolee
2018-08-22 15:24             ` Jeff King
2018-08-22 12:42         ` Paul Smith
2018-08-22 15:23           ` Jeff King
2018-08-23  1:23             ` Jonathan Nieder
2018-08-23  2:16               ` Jeff King
2018-08-23  2:27                 ` Jonathan Nieder
2018-08-23  5:02                   ` Jeff King
2018-08-23  5:09                     ` brian m. carlson
2018-08-23  5:10                     ` Jonathan Nieder
2018-08-23 13:20                     ` Junio C Hamano
2018-08-23 16:31                       ` Jeff King [this message]
2018-08-23  3:47                 ` brian m. carlson
2018-08-23  5:04                   ` Jeff King
2018-08-23 10:26                     ` Derrick Stolee
2018-08-23 13:16                       ` Junio C Hamano
2018-08-23 16:14                       ` Jeff King
2018-08-23 23:30                         ` Jacob Keller
2018-08-23 23:40                           ` Jeff King
2018-08-24  0:06                             ` Jeff King
2018-08-24  0:16                               ` Jeff King
2018-08-24  2:48                                 ` Jacob Keller
2018-08-24  2:59                                   ` Jeff King
2018-08-24  6:45                                     ` Jeff King
2018-08-24 11:04                                       ` Derrick Stolee
2018-08-27 19:36                                     ` Junio C Hamano
2018-08-23 18:53                       ` Jeff King
2018-08-23 20:59                         ` Derrick Stolee
2018-08-24  6:56                           ` Jeff King
2018-08-24  7:57                             ` Ævar Arnfjörð Bjarmason
2018-08-24 16:45                           ` Derrick Stolee
2018-08-25  8:26                             ` Jeff King
2018-09-02 18:53                       ` Kaartic Sivaraam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180823163130.GC29579@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=paul@mad-scientist.net \
    --cc=pclouds@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).