From cf56a2c2f4dc6d4a4067387a8fed7296bcee6ae3 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Thu, 30 Jul 2020 21:47:55 +0200 Subject: [PATCH] bench_msg_pingpong: Add number of clock ticks per cycle --- tests/bench_msg_pingpong/main.c | 8 +++++++- tests/bench_msg_pingpong/tests/01-run.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/bench_msg_pingpong/main.c b/tests/bench_msg_pingpong/main.c index 00799676e3..d59752008b 100644 --- a/tests/bench_msg_pingpong/main.c +++ b/tests/bench_msg_pingpong/main.c @@ -19,6 +19,7 @@ */ #include +#include "macros/units.h" #include "thread.h" #include "msg.h" @@ -75,7 +76,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_msg_pingpong/tests/01-run.py b/tests/bench_msg_pingpong/tests/01-run.py index f2d9f5b121..62a4ac060e 100755 --- a/tests/bench_msg_pingpong/tests/01-run.py +++ b/tests/bench_msg_pingpong/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__":