cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Visitor
Visitor
5,664 Views
Registered: ‎08-12-2008

Execution Time in PowerPC.

Hello,

 

I am trying to get the execution time of my code in PPC440.

#include "xtime_l.h"

int main (void)

   XTime start_time;
   XTime stop_time;

XTime_GetTime(&start_time);

---

---

My C program

---

---

XTime_GetTime(&stop_time);

elapsed = (double)(stop_time - start_time); 

 

I get different timings each time i run the code!

So it cant be right way? Any suggestions ?

 

Regards

 

0 Kudos
Reply
3 Replies
Xilinx Employee
Xilinx Employee
5,641 Views
Registered: ‎07-31-2008

You can expect to see some small variations in the execution time for various reasons. To name a few:

  • The PPC440 has advanced features like Branch History Table and Branch Target Address Cache. They are used for instruction prefetching and are in a random state at the start of your program, i.e. influence the program execution time based on their initial state.
  • If your system uses interrupts, the number of interrupts and the time at which interrupts occur influence the execution time. For example, if you have n interrupts in one run and n+1 interrupts in a second run you will see a difference that matches the exception/interrupt routine execution time.
  • If your system uses external memory the number of refresh cycles on the memory matters. The start time of your program is not synchronized to the refresh cycle, i.e. similar to interrupts you can have n refreshes in one run and n+1 refreshes in a second run.
0 Kudos
Reply
Visitor
Visitor
5,614 Views
Registered: ‎08-12-2008

Any solution for that ?

In what way we can get the exact/approx execution time?

 

Anybody working with same ? Suggestions would be helpful.

 

0 Kudos
Reply
Xilinx Employee
Xilinx Employee
5,587 Views
Registered: ‎07-31-2008

How big is the variation that you are seeing relative to the execution time? Maybe, you can post some of your numbers?

 

I would expect your numbers to be very close to the average execution time and the variation should be relative small.

 

0 Kudos
Reply