Hi everyone, How can I measure the time for a snippet of code (e.g., a function call foo), either synchronous or asynchronous, to execute? A straight forward way can be: start_time = Call LocalTime.get(); foo(); end_time = call LocalTime.get();
(end_time - start_time) is regarded as the execution time of function call foo(). However, asynchronous code can preempt foo() during its execution, thus (end_time - start_time) may be overestimation of foo()'s actual execution time. An alternative can be something like the following: disable interrupt; start_time = Call LocalTime.get(); foo(); end_time = call LocalTime.get(); enable interrupt; However, this can be problematic also if some critical interrupts (e.g., packet reception) occur when the interrupt is disabled. Can anyone have some idea on how execution time can be measured without the above issues? Any help is appreciated. -- -Xiaohui Liu
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
