perf: offer full details in perfrevlogwrite
authorBoris Feld <boris.feld@octobus.net>
Wed, 03 Oct 2018 11:04:57 +0200
changeset 40598 4dd7edeb3da9
parent 40597 164b2e77f9a5
child 40599 c63081cd3902
perf: offer full details in perfrevlogwrite This will be useful for people who want to study the timing pattern more closely.
contrib/perf.py
--- 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)