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.

How to profile during optimization?

Hello guys,

                    I am trying to optimize(to reduce execution time) a small piece of code for C64x+ target using Code Composer Studio version 3.3. I used  clock () function defined in < time.h> .I calculated the overhead of calling clock() as follows:

  1. start = clock();
  2. stop = clock();
  3. overhead = stop - start;

The problem is that the call to clock() function itself is taking 1800 cycles!! ,while my unoptimized code takes nearly 60 cycles.Please let me know whether profiling option provided by CCS IDE or clock() function should be used during optimization.

I forgot mention in the last post, the header file <time.h> is part of rts64x+ library provided by TI.

 

  • Since you are using a C64x+ target, you have access to the Time Stamp Counter in the DSP core to get 1-cycle granularity in embedded timing measurements. The "clock()" function may use the less granular timer peripheral or may use the PC clock, and using the PC clock would not be good for DSP timing measurements especially for a short duration as in your case.

    Please see an example posting at http://e2e.ti.com/forums/p/10574/41680.aspx#41680 for how to use the TSC for benchmarking your routine. It would still be good to use your overhead calculation technique to improve even a few cycles of the accuracy of the measurement.

    And profiling will work very well, also, and will allow you to get measurements without impacting the code at all since no embedded measurements will have to be added.

  • I tried using TSC control register but the compiler is throwing an error messages :"LTEULTX_SC_PUSCHBlockcodingHARQRI.c", line 82: error: unrecognized cregister name 'TSCL'

    :"LTEULTX_SC_PUSCHBlockcodingHARQRI.c", line 82: error: the modifier "cregister" is not allowed on this declaration

    I included <c6x.h> header file also...

    since I am using CCS for the first time,I am not able to rectify the error..  and also I am using C64X+ simulator only...

  • If you look inside c6x.h, you will find the declaration for TSCL. But it follows a "#if defined" statement that is looking for _TMS320C6400_PLUS to be defined.

    You probably are not compiling for the C64x+. Check your Project->Build Options..., under the Compiler tab and the Category:Basic, please make sure Target Version is set you C64x+ (-mv6400+) rather than the default of C64xx (-mv6400). Whenever you create a new project, you will have to do this because there is not a C64x+ choice in the New Project box for the Target selection.

  • OH... I changed the target from c64 to c64x+ it is working now..  Thank you...