sample: subys: logging: fix for posix arch

In the POSIX arch, time does not pass inside infinite loops.
=> Add a small delay in each iteration of those loops
when compiled for it.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
This commit is contained in:
Alberto Escolar Piedras 2018-09-14 07:30:40 +02:00 committed by Carles Cufí
commit 169cab0902

View file

@ -171,6 +171,9 @@ static void performance_showcase(void)
start_timestamp = timestamp_get();
while (start_timestamp == timestamp_get()) {
#if (CONFIG_ARCH_POSIX)
k_busy_wait(100);
#endif
}
start_timestamp = timestamp_get();
@ -179,6 +182,9 @@ static void performance_showcase(void)
LOG_INF("performance test - log message %d", cnt);
cnt++;
current_timestamp = timestamp_get();
#if (CONFIG_ARCH_POSIX)
k_busy_wait(100);
#endif
} while (current_timestamp < (start_timestamp + window));
per_sec = (cnt * timestamp_freq()) / window;