contrib/perf.py
changeset 42364 a09829e14fc0
parent 42360 3293086ff663
child 42370 c2d10506725c
--- a/contrib/perf.py	Wed May 22 16:20:34 2019 -0700
+++ b/contrib/perf.py	Thu May 23 19:05:39 2019 +0200
@@ -275,6 +275,8 @@
     def __exit__(self, *args):
         pass
 
+NOOPCTX = noop()
+
 def gettimer(ui, opts=None):
     """return a timer function and formatter: (timer, formatter)
 
@@ -405,7 +407,7 @@
     begin = util.timer()
     count = 0
     if profiler is None:
-        profiler = noop()
+        profiler = NOOPCTX
     for i in xrange(prerun):
         if setup is not None:
             setup()
@@ -417,6 +419,7 @@
         with profiler:
             with timeone() as item:
                 r = func()
+        profiler = NOOPCTX
         count += 1
         results.append(item[0])
         cstop = util.timer()