From 4323693e69da14a28485afb4ada327491d78e8c2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 22 Jul 2020 14:27:53 +0200 Subject: fix runner.get_counter_limits_us for non-default cpu frequencies --- bin/generate-dfa-benchmark.py | 4 ++-- lib/runner.py | 4 ++-- 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)) -- cgit v1.2.3