diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-10-24 15:45:21 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-10-24 15:45:21 +0200 |
commit | b1d1619866c07af277cdf0965defd91f3b869304 (patch) | |
tree | 49f3f3fbb6a5c3705b53739792aeb7689f53df6f | |
parent | 2b28a0718f3712ac0dad5147ffe859a6c53f0c35 (diff) |
generate-dfa-benchmark: restart log on missed UART sync
-rwxr-xr-x | bin/generate-dfa-benchmark.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/bin/generate-dfa-benchmark.py b/bin/generate-dfa-benchmark.py index 3ae51e6..e157f1f 100755 --- a/bin/generate-dfa-benchmark.py +++ b/bin/generate-dfa-benchmark.py @@ -95,6 +95,9 @@ def benchmark_from_runs(pta: PTA, runs: list, harness: OnboardTimerHarness, benc # This is also useful to faciliate MIMOSA calibration after flashing outbuf.write('arch.delay_ms(12000);\n') + # Output some newlines to ensure the parser can determine the start of the first real output line + outbuf.write('kout << endl << endl;\n') + if 'setup' in pta.codegen: for call in pta.codegen['setup']: outbuf.write(call) @@ -200,20 +203,37 @@ def run_benchmark(application_file: str, pta: PTA, runs: list, arch: str, app: s if 'mimosa' in opt: files = list() - for i in range(opt['repeat']): + i = 0 + while i < opt['repeat']: runner.flash(arch, app, run_args) monitor = runner.get_monitor(arch, callback = harness.parser_cb, mimosa = opt['mimosa']) + sync_error = False try: slept = 0 while not harness.done: + # possible race condition: if the benchmark completes at this + # exact point, it sets harness.done and unsets harness.synced. + # vvv + if slept > 30 and slept < 40 and not harness.synced and not harness.done: + print('[RUN] has been unsynced for more than 30 seconds, assuming error. Retrying.') + sync_error = True + break time.sleep(5) slept += 5 print('[RUN] {:d}/{:d} ({:.0f}%), current benchmark at {:.0f}%'.format(run_offset, runs_total, run_offset * 100 / runs_total, slept * 100 / run_timeout)) except KeyboardInterrupt: pass + monitor.close() - files.extend(monitor.get_files()) + + if sync_error: + for filename in monitor.get_files(): + os.remove(filename) + else: + files.extend(monitor.get_files()) + i += 1 + harness.restart() return [(runs, harness, monitor, files)] |