Page 1 of 1

STM32F4 Discovery function execution time

Posted: Fri Dec 13, 2013 3:25 pm
by Jessica
Hello,

I need to measure the execution time of a function ( function1() ) in milliseconds and print it. I wrote this code but it just gives me the system ticks. I need milliseconds.

systime_t start,stop, final;
start = chTimeNow();
function ();
stop = chTimeNow();
final = stop - start;
chprintf(chp, Time : %ld.%06ld\r\n",final);

Thank you for your help.
Jessi

Re: STM32F4 Discovery function execution time

Posted: Fri Dec 13, 2013 6:40 pm
by Giovanni
Hi,

CH_FREQUENCY should allow you to convert. The version in the repository has new macros for this. 2.6.2 should be released next week with the new macros.

Giovanni

Re: STM32F4 Discovery function execution time

Posted: Fri Dec 13, 2013 8:40 pm
by Jessica
Giovanni wrote:Hi,

CH_FREQUENCY should allow you to convert. The version in the repository has new macros for this. 2.6.2 should be released next week with the new macros.

Giovanni


Thanks for your reply,
I think CH_FREQUENCY is a defined constant. How can I use it?
Where is the repository?

Re: STM32F4 Discovery function execution time

Posted: Fri Dec 13, 2013 8:47 pm
by Tectu
Jessica wrote:Where is the repository?

http://chibios.org/dokuwiki/doku.php?id ... s:download


~ Tectu

Re: STM32F4 Discovery function execution time

Posted: Sun Dec 15, 2013 7:52 am
by Jessica
Tectu wrote:
Jessica wrote:Where is the repository?

http://chibios.org/dokuwiki/doku.php?id ... s:download


~ Tectu


Thank you.