changeset 40551:4dd7edeb3da9

perf: offer full details in perfrevlogwrite This will be useful for people who want to study the timing pattern more closely.
author Boris Feld <boris.feld@octobus.net>
date Wed, 03 Oct 2018 11:04:57 +0200
parents 164b2e77f9a5
children c63081cd3902
files contrib/perf.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Wed Oct 03 10:53:29 2018 +0200
+++ b/contrib/perf.py	Wed Oct 03 11:04:57 2018 +0200
@@ -1571,6 +1571,7 @@
          [(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=1000, stoprev=-1, **opts):
@@ -1610,6 +1611,13 @@
     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)