[Tinyos-help] Calculate time taken for a function execution.

nivedita datta sweetnivi88 at gmail.com
Sat Dec 7 03:53:28 PST 2013


I am trying to calculate the time taken by a function that I wrote. I am
using the component LocalTimeMilliC to do this. I have added the following
lines to the configuration file:

*components LocalTimeMilliC;
TestC.LocalTime -> LocalTimeMilliC;*

...and in the module section of the implementation:

*uses interface LocalTime<TMilli>;*

...and in the code:

*uint32_t timestamp, timestamp1;**timestamp = call LocalTime.get();
**...
function called here ...
...
timestamp1 = call LocalTime.get();
dbg("Boot", "Function took %f millisecs\n", (ts1 - ts) );
*

However, it always prints the value as 0.000000 millisecs. Please let
me know what am I doing wrong in this code or if there is a
better method to  calculate the time taken for execution of a function.
Thanks for your time & effort.
Regards, Nivedita Datta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20131207/eb86cbb2/attachment.htm 


More information about the Tinyos-help mailing list