[PATCH 1 of 3] perf: use the same timer for all section of perfrevlogrevision

Boris Feld boris.feld at octobus.net
Tue Nov 6 10:34:21 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1541499211 -3600
#      Tue Nov 06 11:13:31 2018 +0100
# Node ID 92466f201ed80783a2e1d37ad4fd1ff80df1f36a
# Parent  c2a0bc6412dbbcbba20517e250b0fcd2fc79b0e7
# EXP-Topic sparse-prefrevlogrevision
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 92466f201ed8
perf: use the same timer for all section of perfrevlogrevision

Otherwise the -T json output is invalid.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1790,10 +1790,10 @@ def perfrevlogrevision(ui, repo, file_, 
         (lambda: dohash(text), b'hash'),
     ]
 
+    timer, fm = gettimer(ui, opts)
     for fn, title in benches:
-        timer, fm = gettimer(ui, opts)
         timer(fn, title=title)
-        fm.end()
+    fm.end()
 
 @command(b'perfrevset',
          [(b'C', b'clear', False, b'clear volatile cache between each call.'),


More information about the Mercurial-devel mailing list