analysis of time consumed by a function in run time operation

Thread Starter

ak52

Joined Oct 15, 2014
195
Hello Everyone,

Is there a better way or a more accurate of analyzing the amount of time a function takes to execute.Currently i am doing it like this.

start_timer();
display_lcd_data(); //function which is to be analyzed.
stop_timer();
read_timer_value();

My program had a few regular ISRs(interrupt service routines) so i need to know that the given function should finish its execution before the next ISR comes in.

Thanks,
AK
 

ErnieM

Joined Apr 24, 2011
8,009
The best way will accurately cont every machine cycle your measured routine requires. Errors begin when the count is larger or smaller.

No one but you has any idea how accurate your method is since you have not disclosed the method, the machine, the compiler, or any details whatsoever.

Some packages have simulators that can run code and count machine cycles for you. They work without adding any extra code.

Do be aware that the very same routine can have a variable time to complete depending on the data it is processing.
 

Thread Starter

ak52

Joined Oct 15, 2014
195
I am using a dsPIC33E,compiler XC16,debugger is Pickit3.
A little bit of looking around here i found the stop watch feature ,which is exactly what i need :)

Many Thanks,
AK
 
Top