##// END OF EJS Templates
perf: introduce a `perf.run-limits` options...
marmoute -
r42186:5a1e621b default
parent child Browse files
Show More
@@ -15,6 +15,16 b' Configurations'
15 15 ``presleep``
16 16 number of second to wait before any group of run (default: 1)
17 17
18 ``run-limits``
19 Control the number of run each benchmark will perform. The option value
20 should be a list of `<time>-<numberofrun>` pairs. After each run the
21 condition are considered in order with the following logic:
22
23 If benchmark have been running for <time> seconds, and we have performed
24 <numberofrun> iterations, stop the benchmark,
25
26 The default value is: `3.0-100, 10.0-3`
27
18 28 ``stub``
19 29 When set, benchmark will only be run once, useful for testing (default: off)
20 30 '''
@@ -225,6 +235,9 b' try:'
225 235 configitem(b'perf', b'all-timing',
226 236 default=mercurial.configitems.dynamicdefault,
227 237 )
238 configitem(b'perf', b'run-limits',
239 default=mercurial.configitems.dynamicdefault,
240 )
228 241 except (ImportError, AttributeError):
229 242 pass
230 243
@@ -297,7 +310,34 b' def gettimer(ui, opts=None):'
297 310
298 311 # experimental config: perf.all-timing
299 312 displayall = ui.configbool(b"perf", b"all-timing", False)
300 return functools.partial(_timer, fm, displayall=displayall), fm
313
314 # experimental config: perf.run-limits
315 limitspec = ui.configlist(b"perf", b"run-limits", [])
316 limits = []
317 for item in limitspec:
318 parts = item.split('-', 1)
319 if len(parts) < 2:
320 ui.warn(('malformatted run limit entry, missing "-": %s\n'
321 % item))
322 continue
323 try:
324 time_limit = float(parts[0])
325 except ValueError as e:
326 ui.warn(('malformatted run limit entry, %s: %s\n'
327 % (e, item)))
328 continue
329 try:
330 run_limit = int(parts[1])
331 except ValueError as e:
332 ui.warn(('malformatted run limit entry, %s: %s\n'
333 % (e, item)))
334 continue
335 limits.append((time_limit, run_limit))
336 if not limits:
337 limits = DEFAULTLIMITS
338
339 t = functools.partial(_timer, fm, displayall=displayall, limits=limits)
340 return t, fm
301 341
302 342 def stub_timer(fm, func, setup=None, title=None):
303 343 if setup is not None:
@@ -55,6 +55,16 b' perfstatus'
55 55 "presleep"
56 56 number of second to wait before any group of run (default: 1)
57 57
58 "run-limits"
59 Control the number of run each benchmark will perform. The option value
60 should be a list of '<time>-<numberofrun>' pairs. After each run the
61 condition are considered in order with the following logic:
62
63 If benchmark have been running for <time> seconds, and we have performed
64 <numberofrun> iterations, stop the benchmark,
65
66 The default value is: '3.0-100, 10.0-3'
67
58 68 "stub"
59 69 When set, benchmark will only be run once, useful for testing (default:
60 70 off)
@@ -231,6 +241,31 b' perfstatus'
231 241 $ hg perfparents
232 242 $ hg perfdiscovery -q .
233 243
244 Test run control
245 ----------------
246
247 Simple single entry
248
249 $ hg perfparents --config perf.stub=no --config perf.run-limits='0.000000001-15'
250 ! wall * comb * user * sys * (best of 15) (glob)
251
252 Multiple entries
253
254 $ hg perfparents --config perf.stub=no --config perf.run-limits='500000-1, 0.000000001-5'
255 ! wall * comb * user * sys * (best of 5) (glob)
256
257 error case are ignored
258
259 $ hg perfparents --config perf.stub=no --config perf.run-limits='500, 0.000000001-5'
260 malformatted run limit entry, missing "-": 500
261 ! wall * comb * user * sys * (best of 5) (glob)
262 $ hg perfparents --config perf.stub=no --config perf.run-limits='aaa-12, 0.000000001-5'
263 malformatted run limit entry, could not convert string to float: aaa: aaa-12
264 ! wall * comb * user * sys * (best of 5) (glob)
265 $ hg perfparents --config perf.stub=no --config perf.run-limits='12-aaaaaa, 0.000000001-5'
266 malformatted run limit entry, invalid literal for int() with base 10: 'aaaaaa': 12-aaaaaa
267 ! wall * comb * user * sys * (best of 5) (glob)
268
234 269 test actual output
235 270 ------------------
236 271
General Comments 0
You need to be logged in to leave comments. Login now