summaryrefslogtreecommitdiff
path: root/bin/generate-dfa-benchmark.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/generate-dfa-benchmark.py')
-rwxr-xr-xbin/generate-dfa-benchmark.py43
1 files changed, 21 insertions, 22 deletions
diff --git a/bin/generate-dfa-benchmark.py b/bin/generate-dfa-benchmark.py
index 6540702..c8681c5 100755
--- a/bin/generate-dfa-benchmark.py
+++ b/bin/generate-dfa-benchmark.py
@@ -223,17 +223,11 @@ def benchmark_from_runs(
)
elif opt["sleep"]:
if "energytrace" in opt:
- outbuf.write(
- "arch.sleep_ms({:d}); // {}\n".format(
- opt["sleep"], transition.destination.name
- )
- )
+ outbuf.write(f"// -> {transition.destination.name}\n")
+ outbuf.write(target.sleep_ms(opt["sleep"]))
else:
- outbuf.write(
- "arch.delay_ms({:d}); // {}\n".format(
- opt["sleep"], transition.destination.name
- )
- )
+ outbuf.write(f"// -> {transition.destination.name}\n")
+ outbuf.write("arch.delay_ms({:d});\n".format(opt["sleep"]))
outbuf.write(harness.stop_run(num_traces))
if dummy:
@@ -289,7 +283,7 @@ def run_benchmark(
needs_split = True
else:
try:
- runner.build(arch, app, run_args)
+ target.build(app, run_args)
except RuntimeError:
if len(runs) > 50:
# Application is too large -> split up runs
@@ -342,14 +336,14 @@ def run_benchmark(
i = 0
while i < opt["repeat"]:
print(f"""[RUN] flashing benchmark {i+1}/{opt["repeat"]}""")
- runner.flash(arch, app, run_args)
+ target.flash(app, run_args)
if "mimosa" in opt:
- monitor = runner.get_monitor(
- arch, callback=harness.parser_cb, mimosa=opt["mimosa"]
+ monitor = target.get_monitor(
+ callback=harness.parser_cb, mimosa=opt["mimosa"]
)
elif "energytrace" in opt:
- monitor = runner.get_monitor(
- arch, callback=harness.parser_cb, energytrace=opt["energytrace"]
+ monitor = target.get_monitor(
+ callback=harness.parser_cb, energytrace=opt["energytrace"]
)
sync_error = False
@@ -400,8 +394,8 @@ def run_benchmark(
return [(runs, harness, monitor, files)]
else:
- runner.flash(arch, app, run_args)
- monitor = runner.get_monitor(arch, callback=harness.parser_cb)
+ target.flash(app, run_args)
+ monitor = target.get_monitor(callback=harness.parser_cb)
if arch == "posix":
print("[RUN] Will run benchmark for {:.0f} seconds".format(run_timeout))
@@ -518,6 +512,11 @@ if __name__ == "__main__":
print(err)
sys.exit(2)
+ if "msp430fr" in opt["arch"]:
+ target = runner.Arch(opt["arch"], ["cpu_freq=8000000"])
+ else:
+ target = runner.Arch(opt["arch"])
+
modelfile = args[0]
pta = PTA.from_file(modelfile)
@@ -594,8 +593,8 @@ if __name__ == "__main__":
if "codegen" in driver_definition and "flags" in driver_definition["codegen"]:
if run_flags is None:
run_flags = driver_definition["codegen"]["flags"]
- if run_flags is None:
- run_flags = opt["run"].split()
+ if "run" in opt:
+ run_flags.extend(opt["run"].split())
runs = list(
pta.dfs(
@@ -644,7 +643,7 @@ if __name__ == "__main__":
gpio_pin=timer_pin,
gpio_mode=gpio_mode,
pta=pta,
- counter_limits=runner.get_counter_limits_us(opt["arch"]),
+ counter_limits=target.get_counter_limits_us(run_flags),
log_return_values=need_return_values,
repeat=1,
energytrace_sync=energytrace_sync,
@@ -653,7 +652,7 @@ if __name__ == "__main__":
harness = OnboardTimerHarness(
gpio_pin=timer_pin,
pta=pta,
- counter_limits=runner.get_counter_limits_us(opt["arch"]),
+ counter_limits=target.get_counter_limits_us(run_flags),
log_return_values=need_return_values,
repeat=opt["repeat"],
)