[PATCH 2 of 2] perf: add an option to profile the benchmark section

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu May 23 03:03:48 EDT 2019



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.david at 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.

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list