From b1539aab3973dab0908281125a95c4b84f52fd3d Mon Sep 17 00:00:00 2001 From: Henrik Stickann <4376396-Mithradir@users.noreply.gitlab.com> Date: Fri, 2 Dec 2022 16:36:40 +0100 Subject: [PATCH] Add runtime stats hook module --- src/runtime_stats.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/runtime_stats.c diff --git a/src/runtime_stats.c b/src/runtime_stats.c new file mode 100644 index 0000000..2841d23 --- /dev/null +++ b/src/runtime_stats.c @@ -0,0 +1,20 @@ +#include +#ifdef STA_RTOS_STM32_RUNTIME_TIM + +#include + + +void configureTimerForRunTimeStats() +{ + // Start timer base + HAL_TIM_Base_Start(&STA_RTOS_STM32_RUNTIME_TIM); + // Reset timer + __HAL_TIM_SET_COUNTER(&STA_RTOS_STM32_RUNTIME_TIM, 0); +} + +unsigned long getRunTimeCounterValue() +{ + return __HAL_TIM_GET_COUNTER(&STA_RTOS_STM32_RUNTIME_TIM); +} + +#endif // STA_RTOS_STM32_RUNTIME_TIM