I want to measure how long does a single function take on STM32. The only thing I could find is SysTick_Handler
. However, that is an periodic interrupt, but what I need is get time interval like:
long t1 = mcu_clock();
sleep(20);
long t2 = mcu_clock();
long diff = (t2 - t1);
I've tried C clock()
, but it didn't work and always return -1
. How can I make it?