summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-07-22 14:27:53 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-07-22 14:27:53 +0200
commit4323693e69da14a28485afb4ada327491d78e8c2 (patch)
treed2b2a64171fe72b6886816c3c91c038e672cd166
parentf519d3c9500e4b5a56f8400f18e97dcc70a8718c (diff)
fix runner.get_counter_limits_us for non-default cpu frequencies
-rwxr-xr-xbin/generate-dfa-benchmark.py4
-rw-r--r--lib/runner.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/bin/generate-dfa-benchmark.py b/bin/generate-dfa-benchmark.py
index 2c53d9f..356734b 100755
--- a/bin/generate-dfa-benchmark.py
+++ b/bin/generate-dfa-benchmark.py
@@ -639,7 +639,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=runner.get_counter_limits_us(opt["arch"], run_flags),
log_return_values=need_return_values,
repeat=1,
)
@@ -647,7 +647,7 @@ if __name__ == "__main__":
harness = OnboardTimerHarness(
gpio_pin=timer_pin,
pta=pta,
- counter_limits=runner.get_counter_limits_us(opt["arch"]),
+ counter_limits=runner.get_counter_limits_us(opt["arch"], run_flags),
log_return_values=need_return_values,
repeat=opt["repeat"],
)
diff --git a/lib/runner.py b/lib/runner.py
index 96569a8..e45630a 100644
--- a/lib/runner.py
+++ b/lib/runner.py
@@ -422,12 +422,12 @@ def sleep_ms(duration: int, arch: str, cpu_freq: int = None) -> str:
return f"arch.sleep_ms({duration});\n"
-def get_counter_limits_us(arch: str) -> tuple:
+def get_counter_limits_us(arch: str, opts=list()) -> tuple:
"""Return duration of one counter step and one counter overflow in us."""
cpu_freq = 0
overflow_value = 0
max_overflow = 0
- for line in get_info(arch):
+ for line in get_info(arch, opts):
match = re.match(r"CPU\s+Freq:\s+(.*)\s+Hz", line)
if match:
cpu_freq = int(match.group(1))