You are not logged in.
Dear All,
I want to measure the execution time of a part of my C code.
i found a function called XTime_GetTime().
i have 2 questions :
1- do i need a xps_timer peripheral to be connected to my bus, if so which mode i should use it in ??
2- is there any other options that can i use to measure the time ??
thanks
Offline
1- A timer peripheral is not required to use XTime; the PPC has an internal timer for this.
2- An alternative is to use a GPIO core to assert outputs high/low at various points in your code, then measure the intervals with an oscilloscope. This method has the benefit of providing measurements per iteration of a loop (or per packet) without having to use printf. We've used both approaches in the past.
Offline
I have questions regarding to calculating the execution time. I use the function XTime_GetTime(), and print it out with xil_printf ("%d", xtime), and I got something like 10472380.
(a). Is this value in the unit of CPU cycles or of seconds?
(b). If this is CPU cycles, should I convert it to seconds by doing running_time = cpu_cycles / cpu_speed?
(c). Where can I find the CPU speed? From what I read here and I quote the relevant part as follows, it depends on the compiler and speed grade.
"To achieve the maximum PPC405 Processor Core operating frequency of 400 MHz for the -11 speed grade and 350 MHz for the -10 speed grade, a change must be made to the GNU compiler supplied by Xilinx."
Many thanks in advance!
Last edited by Jettank (2011-May-24 11:58:32)
Offline
I believe XTime uses CPU clock cycles as the base unit. For the OFDM ref design, the CPU runs at 240MHz. Also, be careful with data types when using XTime; it deals in long long int (64-bit integers). xil_printf can't interpret these directly, so you may need to print the high/low halves separately, depending on the range of intervals you're measuring.
Offline