On 5/23/19 4:16 PM, Yuya Nishihara wrote:
On Thu, 23 May 2019 09:03:48 +0200, Pierre-Yves David wrote:
On 5/23/19 1:21 AM, Yuya Nishihara wrote:
On Wed, 22 May 2019 16:46:11 +0200, Pierre-Yves David wrote:
# HG changeset patch
# User Pierre-Yves David <pierre-yves.da...@octobus.net>
# Date 1558445208 -7200
#      Tue May 21 15:26:48 2019 +0200
# Node ID b5c316b4248f3add425313ac0f443c8888706b79
# Parent  8553423d79608bd5d144456448509bdf98c6df11
# EXP-Topic perf-profile
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
b5c316b4248f
perf: add an option to profile the benchmark section

Queued, thanks.

@@ -389,8 +414,9 @@ def _timer(fm, func, setup=None, title=N
       while keepgoing:
           if setup is not None:
               setup()
-        with timeone() as item:
-            r = func()
+        with profiler:
+            with timeone() as item:
+                r = func()

Is it okay to enter/exit to the same profiler more than once?

The following entre/exit are do not do anything. We could make this
explicit by replacing the profiler with a `noop()` object after the
first loop. but I am not sure this is useful.

Explicit noop seems better. The code looks as if it run profiling for
each loop. The profile context manager can at least blow up if entered/exited
more than once.

Okay, I'll follow up with that.


--
Pierre-Yves David
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to