equal
deleted
inserted
replaced
27 # redirect all to stderr |
27 # redirect all to stderr |
28 ui = ui.copy() |
28 ui = ui.copy() |
29 ui.fout = ui.ferr |
29 ui.fout = ui.ferr |
30 # get a formatter |
30 # get a formatter |
31 fm = ui.formatter('perf', opts) |
31 fm = ui.formatter('perf', opts) |
|
32 # stub function, runs code only once instead of in a loop |
|
33 # experimental config: perf.stub |
|
34 if ui.configbool("perf", "stub"): |
|
35 return functools.partial(stub_timer, fm), fm |
32 return functools.partial(_timer, fm), fm |
36 return functools.partial(_timer, fm), fm |
|
37 |
|
38 def stub_timer(fm, func, title=None): |
|
39 func() |
33 |
40 |
34 def _timer(fm, func, title=None): |
41 def _timer(fm, func, title=None): |
35 results = [] |
42 results = [] |
36 begin = time.time() |
43 begin = time.time() |
37 count = 0 |
44 count = 0 |