Index: tools/skpbench/skpbench.py |
diff --git a/tools/skpbench/skpbench.py b/tools/skpbench/skpbench.py |
index 6bf39750a409809411ac87dcb30ed3c7ab9a764d..3b95166f9a1d36ee89807c4707a6958cf6af9fb3 100755 |
--- a/tools/skpbench/skpbench.py |
+++ b/tools/skpbench/skpbench.py |
@@ -113,6 +113,22 @@ class SKPBench: |
def print_header(cls): |
subprocess.call(cls.ARGV + ['--duration', '0']) |
+ @classmethod |
+ def run_warmup(cls, warmup_time): |
+ if not warmup_time: |
+ return |
+ print('running %i second warmup...' % warmup_time) |
+ commandline = cls.ARGV + ['--duration', str(warmup_time * 1000), |
+ '--config', 'gpu', |
+ '--skp', 'warmup'] |
+ output = subprocess.check_output(commandline).decode('utf-8') |
+ # validate the warmup run output. |
+ for line in output.split('\n'): |
+ match = BenchResult.match(line.rstrip()) |
+ if match and match.bench == 'warmup': |
+ return |
+ raise Exception('Invalid warmup output:\n%s' % output) |
+ |
def __init__(self, skp, config, max_stddev, best_result=None): |
self.skp = skp |
self.config = config |
@@ -230,14 +246,15 @@ def run_benchmarks(configs, skps, hardware): |
skpbench.best_result)) |
except HardwareException as exception: |
+ if FLAGS.verbosity >= 5: |
+ hardware.print_debug_diagnostics() |
skpbench.terminate() |
- naptime = max(hardware.kick_in_time, exception.sleeptime) |
if FLAGS.verbosity >= 1: |
print("%s; taking a %i second nap..." % |
- (exception.message, naptime), file=sys.stderr) |
+ (exception.message, exception.sleeptime), file=sys.stderr) |
benches.appendleft(benchargs) # retry the same bench next time. |
- hardware.sleep(naptime - hardware.kick_in_time) |
- time.sleep(hardware.kick_in_time) |
+ hardware.sleep(exception.sleeptime) |
+ SKPBench.run_warmup(hardware.warmup_time) |
def main(): |
@@ -261,10 +278,7 @@ def main(): |
hardware = Hardware() |
with hardware: |
- if hardware.kick_in_time: |
- print("sleeping %i seconds to allow hardware settings to kick in..." % |
- hardware.kick_in_time, file=sys.stderr) |
- time.sleep(hardware.kick_in_time) |
+ SKPBench.run_warmup(hardware.warmup_time) |
run_benchmarks(configs, skps, hardware) |