How to create measure the execution time of a function with a timer?
Hello,
I am using the STM32F767ZI board and I want to measure the execution time of a function. The function I want to measure is a function I created.
At the moment, I use the timer 9 configured in internal clock (216 MHz) with:
Prescaler = 108
Counter Mode = Up
Counter Period = 59
In my program, to measure the execution time of the function, I use HAL_TIM_Base_Start_IT, HAL_TIM_Base_Stop_IT and HAL_TIM_PeriodElapsedCallback.
HAL_TIM_PeriodElapsedCallback is redefined in the main.c file and increments a variable that allows me to know the number of times the timer has interrupted.
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){
if(htim->Instance == htim9.Instance){
FinChrono = FinChrono+1;
}
}
I was told that it was possible to measure the execution time without using interrupt with the timers but I can’t understand how.
Can you help me ?
