Skip to main content
bmwael1
Associate III
February 22, 2013
Question

measure the duration of a loop ?

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
    This topic has been closed for replies.

    5 replies

    emalund
    Associate III
    February 22, 2013
    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
    Super User
    February 22, 2013
    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...!!
    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Tesla DeLorean
    Guru
    February 22, 2013
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    emalund
    Associate III
    February 22, 2013
    Posted on February 22, 2013 at 23:08

    For (;;) //infinite loop

    {

    ....

    ...

    break;

    ..

    }

    even broken code can be broken :)