AnsweredAssumed Answered

Compiler optimization: Cycle count

Question asked by Remy-ASTIER on Nov 17, 2014
Latest reply on Nov 17, 2014 by Jithul_Janardhanan

Hi all

 

I'm using Measuring Cycle Counts tools  for measure compiler optimization but when I enable Optimization my cycle count does not work whereas without optimization, I obtain value.

 

This is my code:

 

unsigned int i = 0;
unsigned short *m = 0;
unsigned short *n = 0;
unsigned int sum = 5;

 

adi_initComponents();
puts("Init ok \r\n");

 

START_CYCLE_COUNT(start_count);
for (i=0; i < count; i++) //count = 256
{
sum = sum + m[i] * n[i];
}
STOP_CYCLE_COUNT(final_count,start_count);
PRINT_CYCLES("Number of cycles: ",final_count);

 

---------------------------------------------------------------------------------------------------------

And this is the results without optimization: Number of cycles: 8199 and with optimization: Number of cycles: 0

---------------------------------------------------------------------------------------------------------

 

Somebody have an idea?

 

Best regards,

 

Remy

Outcomes