Mercurial > hg
changeset 42018:0e6422942c84
perf: pass limits as a function argument
The function applying the limit has no access to the configuration. Therefore,
some higher layer will have to pass it as argument.
We do this in an independent change to clarify the next change.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 16 Mar 2019 19:11:19 +0000 |
parents | 87066cf5ec0f |
children | 5a1e621b8186 |
files | contrib/perf.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Sat Mar 16 19:08:27 2019 +0000 +++ b/contrib/perf.py Sat Mar 16 19:11:19 2019 +0000 @@ -322,7 +322,8 @@ (10.0, 3), ) -def _timer(fm, func, setup=None, title=None, displayall=False): +def _timer(fm, func, setup=None, title=None, displayall=False, + limits=DEFAULTLIMITS): gc.collect() results = [] begin = util.timer() @@ -338,7 +339,7 @@ cstop = util.timer() # Look for a stop condition. elapsed = cstop - begin - for t, mincount in DEFAULTLIMITS: + for t, mincount in limits: if elapsed >= t and count >= mincount: keepgoing = False break