Show More
@@ -29,8 +29,15 b' def gettimer(ui, opts=None):' | |||||
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 | |
33 |
|
37 | |||
|
38 | def stub_timer(fm, func, title=None): | |||
|
39 | func() | |||
|
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() |
General Comments 0
You need to be logged in to leave comments.
Login now