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 calculate cpu cycles of c64x+ in release mode in CCS3.3

Other Parts Discussed in Thread: MSP430F5438A

Hello experts

I am new to dsp programming and also to DM6446.

1.    Currently I am using CCS 3.3 with windows xp enviornment.
I want to compute fps for my own video codec, which I can build and run for c64x+.
I am using dsp/bios clk module for this. I just want to know that is this a right approach
to get actual cpu cycle or there is something else.

2.    I am not familiar with codec engine, could you please guide me to some document. And please
guide me whether i need codec engine for my complete application which will run on both
cores(arm and dsp) or not.

thanks

  • Codec Engine is probably the easiest way to get your own codec running if you want a traditional 6446 setup (i.e. application on ARM and algorithm on DSP). There are a number of documents and examples that discuss how to use CE.

    If you're not familiar with xDAIS, xDM and CE, I would suggest looking at IUNIVERSAL Examples - http://wiki.davincidsp.com/index.php/Getting_started_with_IUNIVERSAL as well as spending some time looking at the docs in the CE category http://wiki.davincidsp.com/index.php?title=Category:Codec_Engine

    Since it sounds like you're writing a video codec, you'd probably want to use one of the xDM 1.x video interfaces. While the IUNIVERSAL Examples focus on the IUNIVERSAL interface, I think the docs are useful for explaining the process of integrating your algorithm with CE. There are examples within the CE product itself (codec_engine_x_xx/examples) which shows some video examples as well. 

    There are a few ways you can profile once you already have a CE app, and that may be useful to you if you wish to understand the total system performance. See http://wiki.davincidsp.com/index.php/Codec_Engine_Profiling for some ideas. 

  • For question 1, using profile in CCSv3.3, you can get the CPU cycles if you use C64x+ CPU cycle Accurate simulator, and you can also get the total Cycles including L1/L2 cache missing cycles when using C64x+ Cycle Accurate simulator!

  • Yes, You can you CLK module to get the time in CPU cycles.

    This is one of the way:

     

    {

        Uint32 time1 = 0;

        Uint32 time2 = 0;

        Float CPUcycles = 0;

     

        time1 = CLK_gethtime();

        .........

        time2 = CLK_gethtime();

        CPUcycles = (time2 - time1) * CLK_cpuCyclesPerHtime();

    }

     

  • I am also stuck on the same problem of getting the CLK_gethtime() function to work. I want to know about the header files and what i have to include in the build options to get a DSP/BIOS clock to work for my work.I cannot get my program to compile as it shows Undefined Symbol "_CLK_gethtime" .... I need some serious help on this... I am using a C64x+ DSP CCS 3.3...

    Thanks

  • Hi,

    Here is one application showcasing the usage of CLK_gethtime() to measure the time elapsed.

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

    Function description:

    st_startPerfCounter(): Function to start measuring the time

    st_stopPerfCounter(): Function to get the time elapsed

    ------------------Here is the application --------------------------

    /* File to get included for measurement sake in BIOS5 */
    #include <tistdtypes.h>
    #include <stdio.h>
    #include <string.h>
    #include <std.h>
    #include <log.h>
    #include <sys.h>
    #include <tsk.h>
    #include <idl.h>
    #include <ecm.h>
    #include <iom.h>
    #include <gio.h>
    #include <gbl.h>
    #include <clk.h>

    #define DBG_PRINT_TRC0(x)
    #define DBG_PRINT_TRC(x) printf x; printf("\n");
    #define ST_STATUS_OK 0

    static Uint32 st_startTickCount = 0;
    static Uint32 st_endTickCount = 0;


    Int32 st_startPerfCounter(void)
    {
        st_startTickCount = CLK_gethtime(); 
         
        DBG_PRINT_TRC0(("Initial counter value (CLK_gethtime)= %u", st_startTickCount));

     return ST_STATUS_OK;

    }


    Int32 st_stopPerfCounter(void)
    {
        Uint32 tickCount = 0;
     Float CPUcycles = 0;
     Float TimeAbsolute = 0;
     Uint32 timeInMSecs = 0;
       
        tickCount = CLK_gethtime();

     DBG_PRINT_TRC0(("Final counter value  (CLK_gethtime)= %u", tickCount));

     if(tickCount >= st_startTickCount)
     {
            st_endTickCount = tickCount - st_startTickCount;
     }
     else
     {
         st_endTickCount = (0xFFFFFFFF - st_startTickCount) + tickCount;
     }   

        DBG_PRINT_TRC0(("Elapsed h counts = %d", st_endTickCount));

        /* calculate absolute time in cpu cycles */
     CPUcycles = st_endTickCount * CLK_cpuCyclesPerHtime();

        /* calculate absolute time in milli seconds */
        TimeAbsolute = CPUcycles / GBL_getFrequency();

        DBG_PRINT_TRC0(("TimeAbsolute = %f ms", TimeAbsolute));

        /* calculate absolute time in micro seconds */
     timeInMSecs = (Uint32) (TimeAbsolute * 1000);

        DBG_PRINT_TRC(("TimeInMicroSeconds = %u us", timeInMSecs));

     return timeInMSecs;

    }

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

  • Hello,

    Thanks for your reply. I actually want to calculate the time taken for an operation without using the CCS profile clock.  How can that be done  ? I am also having difficulties compiling and linking the files and I cant get the code above to work. Could you please give  me some point of view to the right direction on how to achieve this.

    Thanks

    Dhiraj K. Shah

  • hi,

    What controller you are using?

    Is there any function like CLK_gethtime() in msp430f5438a.

    Because i want to calculate the execution time for single instruction in msp430f5438a.


    thanks,

    Ramana.