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.

CCS/TMS320C6655: Calculate clk cyles using profiling for a code segment of a function

Part Number: TMS320C6655
Other Parts Discussed in Thread: SYSBIOS,

Tool/software: Code Composer Studio

Hi TI

I'm using the Code Composer Studio (v6.2.0) together with XDS200 debugger.

I would like to profile a function to verify how many clk cyles it has been used to run through a loop.

By using the "memory browser" I can identify where the function is located in the external RAM and by using asm-file and lst-file I can identify the code start and stop at the memory.

I really need to have a number of clk cyles it has been taken to run through the code.

My setup:

- The C code:

void CpuLoadTask()
{
  int i; 
  RegisterSystemTask((OS_HTask)TSK_SELF()); 
  while (1) 
  { 
    if (hPerFunc == NULL)
   {
     OS_TaskSleep(OS_SECTOTICK(0.1f) );
   }
  for (i=0 ; i<1000 ; i++)
  {
    ++g_uiCpuLoadDummy;
  }
  ++g_uiCpuLoadCounter;
  }
}

- The asm code when the code is loaded into the memory:

CpuLoadTask():
80177120: 01BC54F6 STW.D2T2 B3,*B15--[2]
80177124: 106C6412 CALLP.S2 ti_sysbios_knl_Task_self__E (PC+221984 = 0x801ad440),B3
$C$RL12:
80177128: 1F326592 CALLP.S2 RegisterSystemTask (PC-421076 = 0x8011044c),B3
$C$L8, $C$RL14:
8017712c: 0036B46E LDW.D2T2 *+B14[14004],B0
80177130: 200DA120 [ B0] BNOP.S1 $C$RL16 (PC+26 = 0x8017713a),5
80177134: 1F327293 CALLP.S2 OS_TaskSleep (PC-420972 = 0x801104b4),B3
80177138: 4E26 || MVK.L1 10,A4
$C$L9, $C$RL16:
8017713a: 05A6 MVK.L1 0,A3
8017713c: E8100000 .fphead p, l, W, BU, nobr, nosat, 1000000b
80177140: 0201F42A MVK.S2 0x03e8,B4
80177144: 000C98FA CMPGT.L2X B4,A3,B0
80177148: 3014A120 [!B0] BNOP.S1 $C$L11 (PC+40 = 0x80177168),5
8017714c: 02101FD8 MV.L1X B4,A4
$C$L10:
80177150: 0236B36E LDW.D2T2 *+B14[14003],B4
80177154: 6C6E NOP 4
80177156: 2641 ADD.L2 B4,1,B4
80177158: 0236B37E STW.D2T2 B4,*+B14[14003]
8017715c: E4000000 .fphead n, l, W, BU, nobr, nosat, 0100000b
80177160: 25B0 ADD.L1 A3,1,A3
80177162: 6E08 CMPLT.L1 A3,A4,A0
80177164: CFF8A120 [ A0] BNOP.S1 $C$L10 (PC-16 = 0x80177150),5
$C$L11:
80177168: 0236B26E LDW.D2T2 *+B14[14002],B4
8017716c: 6C6E NOP 4
8017716e: 2641 ADD.L2 B4,1,B4
80177170: 0236B27E STW.D2T2 B4,*+B14[14002]
80177174: 0FE6A120 BNOP.S1 $C$RL14 (PC-52 = 0x8017712c),5
80177178: 00000000 NOP

I would like to profile from addr. 0x8017712c - 0x80177178 to see how many clk cycles it take to run through the code segment.

1. From Code Composer studio I've tried to use: "Tools --> Hardware Trace Analyzer -> Function Profiling --> Trace Range --> Start and Stop Addresses -- > Start Address = 0x80177128 --> Stop Address = 0x80177178 --> Start". But there is no usable result from the trace

I've tried as well: 

2. From Code Composer studio I've tried to use: "Tools --> Hardware Trace Analyzer -> Stall Profiling  --> Trace Range --> Start and Stop Addresses -- > Start Address = 0x80177128 --> Stop Address = 0x80177178 --> Start". But there is no usable result from the trace as well

Can you please help with a correct guideline. 

Thanks

BR

Tam Tran

Vestas Wind System

  • Tam Tran,

    C6655 does support trace and you can use trace to do advanced profiling. However you need a trace receiver to capture the data. Instead I would suggest using a more simple method. There is a tool called the profile clock. You can run to the start of your function. Enable the profile clock. Set a breakpoint at the end of the function. Then view the cycles shown in the profile clock.

    Here is a short video that shows how to use the profile clock:
    www.youtube.com/watch

    Regards,
    John
  • JohnS said:
    C6655 does support trace and you can use trace to do advanced profiling. However you need a trace receiver to capture the data.

    The TMS320C6655 datasheet shows a 4KB Embedded Trace Buffer (ETB).

    Is the TMS320C6655 ETB usable as a receiver for the CCS Hardware Trace Analyser?

    [I don't have a TMS320C6655 to try]

  • Ki (one of our CCS experts) gave trace to ETB a try on C6657 and it worked on that. It is basically the dual core version of C6655 so it should be fine.

    The profile clock would be the easiest thing to use but you could use trace.

    There is an older training module on how to use trace on KeyStone devices here: dev.ti.com/.../node

    Unfortunately that link is broken today as our wiki site is down. It should be back up tomorrow.

    Regards,
    John

  • Hi John

    Thanks for your help. It works fine

    BR

    Tam Tran