How do I calculate the execution time for a program?

Status
Not open for further replies.

RamPrasadh

Newbie level 4
Joined
Mar 27, 2013
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,327
Hello,

I use a LPC2148(arm7) in uVision Keil Mdk. I get the dis-assembly listing when I compile any code.Suppose if I want to calculate the execution time for the code, one way is to find the number of cycles for execution each instruction,multiply it with the clock frequency,have a recursive addition for all the instructions and finally I can get it.. But I don want to do it manually. I want to develop an app where if I enter the dis-assembly listing and the clock frequency used, it must give me my execution time. we have the readily available dis-assembly listing for the respective code generated from the ide. But how do I proceed with that? I hope I am clear with my question..

Regards
Ram Prasadh
 

Are you intended to calculate the time taken by whole program or a particular part of the code?

If you're looking for the particular part of the code then you can use timer or counter feature at the start and edn of that part in your code.
Second method is manual! (I know you don't want it) Though it is easier and ACCURATE. just take a pin of controller and toggle it at the starting and ending point of your part of code and then observe it on oscilloscope... you will get the accurate answer as the min. latency is added in this method.
 

What will happen if we work on interrupts? The time on counter will be the total time along with the interrupt service right?? Manually we can use led s once the code enters any service routine, calculate the difference in time at the last and calculate the required time.. May be timer method may work.

Regards
Ram Prasadh
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…