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.

using clock in code composer

Hi,
I have a problem with using clock in code composer, the clock count goes quite different. 

I have a function with two  loops:

for(int i=0;i<128;i++)
{
for(int j=0;j<8;j++)
{
...
...

}
}

Whem I run this code, with two break points before and after the loop, the clock showed 250,000 (for this part)

For some reasons I had to move these lines to a function, the clock this time was much higher, 350,000

1- What might be the reason for this

2- when I run the loops using single step for every line, it needs only 104 clocks for the inside loop, so the total should be something like
104*8*128=106496, (106496<<350000)
what is happening?

Thanks a lot,

   Behzad

  • Hi Behzad,

     the clock showed 250,000 (for this part)

    Use "Go to line" -> "Step Into" functions for better Clock cycle results. Also, always reset the clock after going to particular line; so that you avoid getting junk values.

    Regards,

    Gautam

  • Hi,

    Thanks for your answer.

    I am afraid I did not get exactly what u mean.

    I single stepped each line and reset the clock in each line. result: the sum of the clock values in this test   was the corresponding  value without resetting. 

    In addition I stepped into the assembly code and again the total clocks for a c line was the sum of the clock for the corresponding assembly lines.

    But I guess it had not been what u really mean. I have no idea why running  a piece of code in single steps needs much fewer clock cycles than running it within two breakpoints.

    Again thanks,

       Behzad

  • I single stepped each line and reset the clock in each line. result the sum of the clock values in this test was the corresponding  value without resetting.

    Fine.


    But I guess it had not been what u really mean. I have no idea why running  a piece of code in single steps needs much fewer clock cycles than running it within two breakpoints.


    Sometimes setting improper breakpoints lead to erroneous clock values.

    For some reasons I had to move these lines to a function, the clock this time was much higher, 350,000


    I somehow missed noticing this line! Yup calling a function increases the clock count significanty; I've personally noticed that while working on various mcus in C2000 series. Not sure why.... Never felt like posting but as you've posted lets wait for a response from TIers and close this case :)

    Also, if not answered here, try the CCS forum:

    http://e2e.ti.com/support/development_tools/code_composer_studio/f/81.aspx?pi73857=1

    Regards,

    Gautam