Trying to know the execution time of my function.
I use TSCL to get cycle count, and my device is DM6437, so it's 600MHz?
than 100 cycle equal to 100 / (600 * 10^6) second, is that right?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Trying to know the execution time of my function.
I use TSCL to get cycle count, and my device is DM6437, so it's 600MHz?
than 100 cycle equal to 100 / (600 * 10^6) second, is that right?
Yes, your equation is correct if the CPU clock speed is 600 MHz.
I used the following code to confirm that clock speed:
CPU measurement code said:#if 1 // set to 1 to verify your CPU clock rate
//
// Click Run to go to the asm( SWBP ) breakpoint line,
// Find a clock or timer with visible seconds,
// Click Run again, wait 10 seconds, click Halt,
// Observe the CPU clock rate in the Local Watch Window
//
{
/* verify CPU speed using TSCH/L timestamp counter and a wall clock */
volatile unsigned long long ullTimer1, ullTimer2, CPUClockHz, CPUClockMHz;
volatile int i;
Initial_Setup();
// CCS will halt here so you can sync with the wall clock
asm(" SWBP 0");
TSCL = 0; // write to TSCL to make sure it is running
ullTimer1 = _itoll( TSCH, TSCL ); // get initial TSCH/L value
while (1)
{
ullTimer2 = _itoll( TSCH, TSCL );
CPUClockHz = (ullTimer2-ullTimer1)/10;
CPUClockMHz = CPUClockHz / 1000000;
/* delay (< .5ms) improves chance of stopping in this context */
for ( i = 0; i < 10000; i+=2 )i--;
}
}
#endif
Regards,
RandyP
If this answers your question, please click the Verify Answer button below. If not, please reply back with more information.