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__": diff --git a/tests/bench_mutex_pingpong/main.c b/tests/bench_mutex_pingpong/main.c index 965f801224..447f54da76 100644 --- a/tests/bench_mutex_pingpong/main.c +++ b/tests/bench_mutex_pingpong/main.c @@ -20,6 +20,7 @@ #include +#include "macros/units.h" #include "mutex.h" #include "thread.h" #include "xtimer.h" @@ -78,7 +79,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_mutex_pingpong/tests/01-run.py b/tests/bench_mutex_pingpong/tests/01-run.py index f2d9f5b121..62a4ac060e 100755 --- a/tests/bench_mutex_pingpong/tests/01-run.py +++ b/tests/bench_mutex_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__": 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__": diff --git a/tests/bench_thread_flags_pingpong/main.c b/tests/bench_thread_flags_pingpong/main.c index ef5e037745..625ab51fc0 100644 --- a/tests/bench_thread_flags_pingpong/main.c +++ b/tests/bench_thread_flags_pingpong/main.c @@ -19,6 +19,7 @@ */ #include +#include "macros/units.h" #include "thread.h" #include "thread_flags.h" @@ -74,7 +75,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_thread_flags_pingpong/tests/01-run.py b/tests/bench_thread_flags_pingpong/tests/01-run.py index f2d9f5b121..62a4ac060e 100755 --- a/tests/bench_thread_flags_pingpong/tests/01-run.py +++ b/tests/bench_thread_flags_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__": diff --git a/tests/bench_thread_yield_pingpong/main.c b/tests/bench_thread_yield_pingpong/main.c index 9d514b5622..10c758a053 100644 --- a/tests/bench_thread_yield_pingpong/main.c +++ b/tests/bench_thread_yield_pingpong/main.c @@ -20,6 +20,7 @@ #include +#include "macros/units.h" #include "thread.h" #include "xtimer.h" @@ -71,7 +72,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_thread_yield_pingpong/tests/01-run.py b/tests/bench_thread_yield_pingpong/tests/01-run.py index f2d9f5b121..62a4ac060e 100755 --- a/tests/bench_thread_yield_pingpong/tests/01-run.py +++ b/tests/bench_thread_yield_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__":