From c8f96474f3f5a4cccc8f7cf9ffb9317a45088a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Chru=C5=9Bci=C5=84ski?= Date: Wed, 25 Sep 2024 14:30:24 +0200 Subject: [PATCH] [nrf fromtree] samples: boards: nordic: coresight_stm: Improve benchmark MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add interrupt locking during test to ensure that main thread is not interrupts which would impact the test. Add longer sleep time between tests to ensure that all logs are processed on time and not dropped. Signed-off-by: Krzysztof Chruściński (cherry picked from commit c61e92a79c432ae9fde01ff072ccddea2a4fbe40) --- samples/boards/nrf/coresight_stm/src/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/samples/boards/nrf/coresight_stm/src/main.c b/samples/boards/nrf/coresight_stm/src/main.c index c5bf328678b..01d3d14035c 100644 --- a/samples/boards/nrf/coresight_stm/src/main.c +++ b/samples/boards/nrf/coresight_stm/src/main.c @@ -16,12 +16,14 @@ LOG_MODULE_REGISTER(app); #define TEST_LOG(rpt, item) \ ({ \ + uint32_t key = irq_lock(); \ uint32_t t = k_cycle_get_32(); \ for (uint32_t i = 0; i < rpt; i++) { \ __DEBRACKET item; \ } \ t = k_cycle_get_32() - t; \ - k_msleep(200); \ + irq_unlock(key); \ + k_msleep(400); \ t; \ })