299 hasheader = False
300 benches = collections.deque([(src, config, FLAGS.max_stddev)
301 for src in srcs
302 for config in configs])
303 while benches:
304 try:
305 with hardware:
306 SKPBench.run_warmup(hardware.warmup_time, configs[0])
307 if not hasheader:
309 hasheader = True
310 while benches:
311 benchargs = benches.popleft()
312 with SKPBench(*benchargs)
as skpbench:
313 try:
314 skpbench.execute(hardware)
315 if skpbench.best_result:
316 emit_result(skpbench.best_result.format(FLAGS.suffix),
317 resultsfile)
318 else:
319 print(
"WARNING: no result for %s with config %s" %
320 (skpbench.src, skpbench.config), file=sys.stderr)
321
322 except StddevException:
323 retry_max_stddev = skpbench.max_stddev * math.sqrt(2)
324 if FLAGS.verbosity >= 1:
325 print(
"stddev is too high for %s/%s (%s%%, max=%.2f%%), "
326 "re-queuing with max=%.2f%%." %
327 (skpbench.best_result.config, skpbench.best_result.bench,
328 skpbench.best_result.stddev, skpbench.max_stddev,
329 retry_max_stddev),
330 file=sys.stderr)
331 benches.append((skpbench.src, skpbench.config, retry_max_stddev,
332 skpbench.best_result))
333
334 except HardwareException as exception:
335 skpbench.terminate()
336 if FLAGS.verbosity >= 4:
337 hardware.print_debug_diagnostics()
338 if FLAGS.verbosity >= 1:
339 print(
"%s; rebooting and taking a %i second nap..." %
340 (exception.message, exception.sleeptime), file=sys.stderr)
341 benches.appendleft(benchargs)
342 raise
343
344 except HardwareException as exception:
345 time.sleep(exception.sleeptime)
346