cancel
Showing results for 
Search instead for 
Did you mean: 

measure the duration of a loop ?

bmwael1
Associate II
Posted on February 22, 2013 at 11:20

Hi

Can I measure the duration of a loop in the program of STM32F4 using TIMER ?

For example

______________________________________

Begin (Timer x)

For (;;) //infinite loop

{

....

...

...

..

}

End (Timer x)

______________________________________

The program give me : Timer = 12 ms .

Thanks
5 REPLIES 5
emalund
Associate III
Posted on February 22, 2013 at 16:07

the ONLY way to get absolute timing for a process is to set an I/O bit at start and reset and put a scope on it.

The programs that 'calculate' time do not take cache misses into account

Erik

Andrew Neil
Evangelist III
Posted on February 22, 2013 at 17:31

For (;;) //

infinite

loop

No need to measure  that loop at all - the clue is in the comment...!!
Posted on February 22, 2013 at 19:05

It'll take a while I'd guess....

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
emalund
Associate III
Posted on February 22, 2013 at 23:08

For (;;) //infinite loop

{

....

...

break;

..

}

even broken code can be broken :)