Show More
@@ -275,6 +275,8 b' class noop(object):' | |||||
275 | def __exit__(self, *args): |
|
275 | def __exit__(self, *args): | |
276 | pass |
|
276 | pass | |
277 |
|
277 | |||
|
278 | NOOPCTX = noop() | |||
|
279 | ||||
278 | def gettimer(ui, opts=None): |
|
280 | def gettimer(ui, opts=None): | |
279 | """return a timer function and formatter: (timer, formatter) |
|
281 | """return a timer function and formatter: (timer, formatter) | |
280 |
|
282 | |||
@@ -405,7 +407,7 b' def _timer(fm, func, setup=None, title=N' | |||||
405 | begin = util.timer() |
|
407 | begin = util.timer() | |
406 | count = 0 |
|
408 | count = 0 | |
407 | if profiler is None: |
|
409 | if profiler is None: | |
408 |
profiler = |
|
410 | profiler = NOOPCTX | |
409 | for i in xrange(prerun): |
|
411 | for i in xrange(prerun): | |
410 | if setup is not None: |
|
412 | if setup is not None: | |
411 | setup() |
|
413 | setup() | |
@@ -417,6 +419,7 b' def _timer(fm, func, setup=None, title=N' | |||||
417 | with profiler: |
|
419 | with profiler: | |
418 | with timeone() as item: |
|
420 | with timeone() as item: | |
419 | r = func() |
|
421 | r = func() | |
|
422 | profiler = NOOPCTX | |||
420 | count += 1 |
|
423 | count += 1 | |
421 | results.append(item[0]) |
|
424 | results.append(item[0]) | |
422 | cstop = util.timer() |
|
425 | cstop = util.timer() |
General Comments 0
You need to be logged in to leave comments.
Login now