From 34f860269331f335391f4013e3856e631366f7b6 Mon Sep 17 00:00:00 2001 From: Jaby Date: Wed, 26 Apr 2023 19:09:49 +0200 Subject: [PATCH] Measure the busy loop for real hardware later --- examples/PoolBox/application/src/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/examples/PoolBox/application/src/main.cpp b/examples/PoolBox/application/src/main.cpp index 64bee7d0..0ce2fba7 100644 --- a/examples/PoolBox/application/src/main.cpp +++ b/examples/PoolBox/application/src/main.cpp @@ -1,5 +1,21 @@ +#include #include +extern "C" void busy_loop(int count); + +static void mesaure_busy_loop() { + static constexpr auto Counts = 500; + + JabyEngine::HighResTime::enable(); + const auto start = JabyEngine::HighResTime::get_time_stamp(); + busy_loop(Counts); + const auto end = JabyEngine::HighResTime::get_time_stamp(); + JabyEngine::HighResTime::disable(); + + printf("Busy loop of %i took %ims %ins\n", Counts, start.milliseconds_to(end), start.microseconds_to(end)); +} + void main() { printf("Hello Planschbecken!\n"); + mesaure_busy_loop(); } \ No newline at end of file