From f2a27dd46bfee8d22625ee51fae1a194d35eb9b0 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Thu, 30 Jul 2020 21:51:18 +0200 Subject: [PATCH] bench_sched_nop: Add number of clock ticks per cycle --- tests/bench_sched_nop/main.c | 8 +++++++- tests/bench_sched_nop/tests/01-run.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/bench_sched_nop/main.c b/tests/bench_sched_nop/main.c index 74126b67a4..0e3381985f 100644 --- a/tests/bench_sched_nop/main.c +++ b/tests/bench_sched_nop/main.c @@ -19,6 +19,7 @@ */ #include +#include "macros/units.h" #include "thread.h" #include "xtimer.h" @@ -51,7 +52,12 @@ int main(void) n++; } - printf("{ \"result\" : %"PRIu32" }\n", n); + printf("{ \"result\" : %"PRIu32, n); +#ifdef CLOCK_CORECLOCK + printf(", \"ticks\" : %"PRIu32, + (uint32_t)((TEST_DURATION/US_PER_MS) * (CLOCK_CORECLOCK/KHZ(1)))/n); +#endif + puts(" }"); return 0; } diff --git a/tests/bench_sched_nop/tests/01-run.py b/tests/bench_sched_nop/tests/01-run.py index f2d9f5b121..62a4ac060e 100755 --- a/tests/bench_sched_nop/tests/01-run.py +++ b/tests/bench_sched_nop/tests/01-run.py @@ -12,7 +12,7 @@ from testrunner import run def testfunc(child): - child.expect(r"{ \"result\" : \d+ }") + child.expect(r"{ \"result\" : \d+(, \"ticks\" : \d+)? }") if __name__ == "__main__":