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.

[C6747] Benchmarking

Other Parts Discussed in Thread: OMAP-L137

Does anyone know of an easy way to get timestamps while running my program?  Basically, I have written a program and I need to determine how long it takes to execute several areas of the program (in milliseconds).  I am doing large amounts of DSP and need to see how long it takes to complete tasks in the program.  I will also need it as a benchmark for when I adjust/tune my code to see how the results effect the execution times.

I am using a C6747 dsp (part of the OMAP-L137 development board).  The CCS I am using is the one that came with the board for prototyping.  Thanks for any help.

Scott H.

  • This is a very high-level response, but the easiest way to accomplish something like this is to use either the profiler within CCS or the on-chip timers. The profiler is used to measure cycle counts entire functions, ranges of code, etc.; however, please note that this is primarily used on simulators and may not be as accurate on actual hardware.

    The on-chip timers show a lot more promise on hardware. I'll write some simple pseudo-code below, and if you are interested/get stuck we could look at some actual code.

    /*Random code*/
    int cycle_count = 0;
    int clock_start, clock_stop, overhead;

    /* Configure timer registers */
    timer_config();

    /* Determine timer start/stop overhead */
    clock_start = timer_count_value; // Current count value
    start_timer();
    stop_timer();
    clock_stop = timer_count_value; // New current count value
    overhead = clock_stop - clock_start; // Overhead to start and stop the timer. This # can be saved and reused later in the program

    clock_start = timer_count_value;
    start_timer();
    run_your_function_here();
    stop_timer();
    clock_stop = timer_count_value;

    cycle_count = clock_stop - clock_start - overhead; // # of cycles to execute function

  • You can use the time stamp counter like I mentioned in this thread:

    http://e2e.ti.com/forums/p/2440/9244.aspx#9244

     

  • Good point Brad! I completely missed that he was using the C6747 and wasn't even thinking about the TSC. This would be easier than my solution.

  • Brad and Tim ... thanks alot for the help.  I tried Brads approach and it worked like a charm ... thanks again!

    Scott Hansen

  • Brad,

    The link you supplied shoots me to the main support search page.  A search for "benchmark" did not result in a page with your code.  Will you send me an updated link or cut and paste your code?

    Here is your link that I refer to:

    http://e2e.ti.com/forums/p/2440/9244.aspx#9244

  • I am not sure what thread the old link pointed to. Old links were "broken" during a forum update late 2009 which is why the link you copied sends you to the main page.

    In any case, even though this is probably not the same link this other thread contains the desired code snippet.

  • Brad,

    I am using a C6713 and an OMAP-L137 (w/ a C6747).  I tried compiling for the C6713 and get an error stating that "TSCL" is undefined.  I looked in c6x.h and found that this is only defined for "_TMS320C6400_PLUS".  Can I use this method on my processors?

  • No, you cannot use TSCL on a 6713.  The older 67x and 64x cores do not contain this register.  It was introduced in the 64x+ core and is in newer cores such as the 674x core too.

    If you're using BIOS, which I highly recommend, you can call CLK_gethtime() to get a high-resolution time value based off a Timer.  In this case the number returned by CLK_gethtime will have granularity of timer ticks, which on 6713 corresponds to CPU/4.  For 64x devices like 6416 this would be CPU/8.  In other words if you call CLK_gethtime() before and after whatever code you are benchmarking you should take the difference and multiply by 4 to get the total number of CPU cycles.  For example:

    #include <clk.h>

    unsigned int start, stop, delta, cpu_cycles;

    start = CLK_gethtime();

    // code to be benchmarked;

    stop = CLK_gethtime();

    delta = stop - start;  // number of elapsed timer ticks

    cpu_cycles = delta << 2; // multiply by 4 to get elapsed CPU cycles