Patchwork [2,of,2,V2] perf: offer full details in perfrevlogwrite

login
register
mail settings
Submitter Boris Feld
Date Oct. 19, 2018, 12:25 p.m.
Message ID <5cde431ae243980e68d4.1539951914@localhost.localdomain>
Download mbox | patch
Permalink /patch/36167/
State Superseded
Headers show

Comments

Boris Feld - Oct. 19, 2018, 12:25 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1538557497 -7200
#      Wed Oct 03 11:04:57 2018 +0200
# Node ID 5cde431ae243980e68d49dce02ba8eb4a66d2d08
# Parent  78ffc55c0d6034972ea3d49b8c565c563ef27121
# EXP-Topic revlog-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 5cde431ae243
perf: offer full details in perfrevlogwrite

This will be useful for people who want to study the timing pattern more
closely.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1571,6 +1571,7 @@  def perfrevlogrevisions(ui, repo, file_=
          [(b's', b'startrev', 1000, b'revision to start writing at'),
           (b'', b'stoprev', -1, b'last revision to write'),
           (b'', b'count', 3, b'last revision to write'),
+          (b'', b'details', False, b'print timing for every revisions tested'),
          ],
          b'-c|-m|FILE')
 def perfrevlogwrite(ui, repo, file_=None, startrev=0, stoprev=-1, **opts):
@@ -1610,6 +1611,13 @@  def perfrevlogwrite(ui, repo, file_=None
     fm = ui.formatter(b'perf', opts)
     displayall = ui.configbool(b"perf", b"all-timing", False)
 
+    # print individual details if requested
+    if opts['details']:
+        for idx, item in enumerate(results, 1):
+            rev, data = item
+            title = 'revisions #%d of %d, rev %d' % (idx, resultcount, rev)
+            formatone(fm, data, title=title, displayall=displayall)
+
     # sorts results by median time
     results.sort(key=lambda x: sorted(x[1])[len(x[1]) // 2])
     # list of (name, index) to display)