# HG changeset patch # User Pierre-Yves David # Date 2019-03-16 19:11:19 # Node ID 0e6422942c84502ad58a1a82e15b0be680de1923 # Parent 87066cf5ec0f356a69ab21f6ae35a7de8bf82c23 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. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -322,7 +322,8 @@ DEFAULTLIMITS = ( (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 @@ def _timer(fm, func, setup=None, title=N 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