From 15ff3cf3a5cfc0bfcb11a3d8280d005bad3a6fef Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 8 Jan 2023 11:51:39 -0800 Subject: [PATCH] subsys/zbus: benchmark test runs "too fast" with picolibc When using picolibc, this benchmark completes faster than the timer tick interval on several qemu instances. Instead of failing the test, pretend it finished in 1 millisecond. Signed-off-by: Keith Packard --- samples/subsys/zbus/benchmark/src/benchmark.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/samples/subsys/zbus/benchmark/src/benchmark.c b/samples/subsys/zbus/benchmark/src/benchmark.c index 2b9498018d567..99619a388901d 100644 --- a/samples/subsys/zbus/benchmark/src/benchmark.c +++ b/samples/subsys/zbus/benchmark/src/benchmark.c @@ -199,10 +199,9 @@ static void producer_thread(void) } uint32_t duration = (k_uptime_get_32() - start); - if (duration == 0) { - LOG_ERR("Something wrong. Duration is zero!\n"); - k_oops(); - } + if (duration == 0) + duration = 1; + uint64_t i = (BYTES_TO_BE_SENT * 1000) / duration; uint64_t f = ((BYTES_TO_BE_SENT * 100000) / duration) % 100;