DSPRelated.com
Forums

C6416 DSK Profiling Problem

Started by fati...@yahoo.com June 2, 2011
Hello,

I m using TMS320C6416 DSK with CCS 3.3.I want to profile my code. I m using clock() function for this.But it always gives Zero value. I m using it where i want to start my profiling and ends where i want to stop. Saving both values in variables and subtracting them. But again the problem is this it gives zero. i have also used built-in profiler clock but i can't understand its results. Help me in this matter or tell any other effective method of profiling.

_____________________________________
fatimaarneeb,

On 6/2/2011 12:53 AM, f...@yahoo.com wrote:
>
> Hello,
>
> I m using TMS320C6416 DSK with CCS 3.3.I want to profile my code. I m
> using clock() function for this.But it always gives Zero value.
>

You should not use any of the C standard library functions for anything
'realtime'. If enabled, functions like time() and printf() will stop the
processor with a BP, CCS will poll and read or write some data, and the
the processor will be restarted. Not good for anything time critical.
>
> I m using it where i want to start my profiling and ends where i want
> to stop. Saving both values in variables and subtracting them. But
> again the problem is this it gives zero. i have also used built-in
> profiler clock but i can't understand its results.
>

For profiling you can [a] set a timer to run continuously and read it as
needed [accuracy limited by clock divider], [b]read the high resolution
clock, or [c] use the profiler. For most single measurement cases, at
least initially, reading a timer is a good place to start.
My best advice for using the profiler is to start with a simple
deterministic case - a function with a counter. Have your project save
the asm file so that you know what the timing should be. Use the
profiler [check the help file] and try to correlate the clock count. If
you do multiple 'runs', the initial run will be with uncached code/data.

mikedunn
>
> Help me in this matter or tell any other effective method of profiling.
You should enable the clock by profiler->Enable clock. Then the clock()
functions work proper.

-----Original Message-----
From: c... [mailto:c...]On Behalf Of
f...@yahoo.com
Sent: Thursday, June 02, 2011 11:24 AM
To: c...
Subject: [c6x] C6416 DSK Profiling Problem

Hello,

I m using TMS320C6416 DSK with CCS 3.3.I want to profile my code. I m
using clock() function for this.But it always gives Zero value. I m using it
where i want to start my profiling and ends where i want to stop. Saving
both values in variables and subtracting them. But again the problem is this
it gives zero. i have also used built-in profiler clock but i can't
understand its results. Help me in this matter or tell any other effective
method of profiling.
Hello,
>
>I m using TMS320C6416 DSK with CCS 3.3.I want to profile my code. I m using clock() function for this.But it always gives Zero value. I m using it where i want to start my profiling and ends where i want to stop. Saving both values in variables and subtracting them. But again the problem is this it gives zero. i have also used built-in profiler clock but i can't understand its results. Help me in this matter or tell any other effective method of profiling.
>
>_____________________________________
>
>I hav started to use timers as follow:

TIMER_Handle hTimer;
double cnt=0;

TIMER_Config timerCfg0 = {

TIMER_FMKS(CTL, TSTAT, DEFAULT) |
TIMER_FMKS(CTL, INVINP, DEFAULT) |
TIMER_FMKS(CTL, CLKSRC, CPUOVR8) |
TIMER_FMKS(CTL, CP, CLOCK) |
TIMER_FMKS(CTL, HLD, NO) |
TIMER_FMKS(CTL, GO,YES) |
TIMER_FMKS(CTL, PWID, DEFAULT) |
TIMER_FMKS(CTL, DATIN, DEFAULT) |
TIMER_FMKS(CTL, DATOUT,0) |
TIMER_FMKS(CTL, INVOUT,DEFAULT) |
TIMER_FMKS(CTL, FUNC,TOUT ) |

TIMER_PRD_DEFAULT,
TIMER_CNT_DEFAULT,
};

hTimer = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET);
TIMER_config(hTimer, &timerCfg0);
TIMER_start(hTimer);

////////code here////////////////////

TIMER_pause(hTimer);
cnt = TIMER_getCount(hTimer);
TIMER_close(hTimer);

But value of cnt is still zero. Is there any mistake in configuring Timer or any other. Help me i need it urgently.

_____________________________________
Hello,
>
>I m using TMS320C6416 DSK with CCS 3.3.I want to profile my code. I m using clock() function for this.But it always gives Zero value. I m using it where i want to start my profiling and ends where i want to stop. Saving both values in variables and subtracting them. But again the problem is this it gives zero. i have also used built-in profiler clock but i can't understand its results. Help me in this matter or tell any other effective method of profiling.
>
>_____________________________________
>
>I m using Timer as follow:
TIMER_Handle hTimer;
double cnt=0;
TIMER_Config timerCfg0 = {
TIMER_FMKS(CTL, TSTAT, DEFAULT) |
TIMER_FMKS(CTL, INVINP, DEFAULT) |
TIMER_FMKS(CTL, CLKSRC, CPUOVR8) |
TIMER_FMKS(CTL, CP, CLOCK) |
TIMER_FMKS(CTL, HLD, NO) |
TIMER_FMKS(CTL, GO,YES) |
TIMER_FMKS(CTL, PWID, DEFAULT) |
TIMER_FMKS(CTL, DATIN, DEFAULT) |
TIMER_FMKS(CTL, DATOUT,0) |
TIMER_FMKS(CTL, INVOUT,DEFAULT) |
TIMER_FMKS(CTL, FUNC,TOUT ) |

TIMER_PRD_DEFAULT,
TIMER_CNT_DEFAULT,
};
hTimer = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET);
TIMER_config(hTimer, &timerCfg0);
TIMER_start(hTimer);

/******My Code Here**************/

TIMER_pause(hTimer);
cnt = TIMER_getCount(hTimer);
TIMER_close(hTimer);

But the value of cnt is still zero.Is there any mistake in configuring Timer or any other. if someone has used timer for profiling kindly post me source code.Help me i need it urgently.

_____________________________________
Fatima-

> I m using TMS320C6416 DSK with CCS 3.3.I want to profile my code.
> I m using clock() function for this.But it always
> gives Zero value. I m using it where i want to start my profiling
> and ends where i want to stop. Saving both values
> in variables and subtracting them. But again the problem is this
> it gives zero.

First, are you trying to run code on the simulator or on the actual DSK board? I assume the simulator if you're using
the "clock()" function. For comments about clock(), see this page:

http://processors.wiki.ti.com/index.php/Time_and_clock_RTS_Functions

The simulator can be a useful tool, but in general when you run into problems the level of help you will get is not as
high, because it's not the end-objective for TI -- they want you to use their chips, not PCs to simulate their chips.

Second, I suggest that you instead focus on using DSP library functions (i.e. actual board functions and not software
simulator) since that is what your project is all about. In that case, you can use CLK_xxx() functions provided by
DSP/BIOS. Try this:

-declare a couple of time variables to use, and
initialize them both to different values; e.g.

int t1 = 88;
int t2 = 99;

-then run your code up to line just prior to first
call to setting it with result from CLK_gethtime().
Read t1 using mem display or Watch window -- what
do you get? Obviously it should be 88. If not
then fix this first

-let code run two more lines (t1 = CLK_gethtime(),
and one line after that). Read t1 again. Now
what is it?

There are many TI examples showing use of CLK_xxx() functions. You can use those examples for guidance.

-Jeff

> i have also used built-in profiler
> clock but i can't understand its results. Help me in this matter
> or tell any other effective method of profiling.
>>
>>_____________________________________
>>
>>I m using Timer as follow:
> TIMER_Handle hTimer;
> double cnt=0;
> TIMER_Config timerCfg0 = {
> TIMER_FMKS(CTL, TSTAT, DEFAULT) |
> TIMER_FMKS(CTL, INVINP, DEFAULT) |
> TIMER_FMKS(CTL, CLKSRC, CPUOVR8) |
> TIMER_FMKS(CTL, CP, CLOCK) |
> TIMER_FMKS(CTL, HLD, NO) |
> TIMER_FMKS(CTL, GO,YES) |
> TIMER_FMKS(CTL, PWID, DEFAULT) |
> TIMER_FMKS(CTL, DATIN, DEFAULT) |
> TIMER_FMKS(CTL, DATOUT,0) |
> TIMER_FMKS(CTL, INVOUT,DEFAULT) |
> TIMER_FMKS(CTL, FUNC,TOUT ) |
>
> TIMER_PRD_DEFAULT,
> TIMER_CNT_DEFAULT,
> };
> hTimer = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET);
> TIMER_config(hTimer, &timerCfg0);
> TIMER_start(hTimer);
>
> /******My Code Here**************/
>
> TIMER_pause(hTimer);
> cnt = TIMER_getCount(hTimer);
> TIMER_close(hTimer);
>
> But the value of cnt is still zero.Is there any mistake in configuring Timer or any other. if someone has used timer
> for profiling kindly post me source code.Help me i need it urgently.

_____________________________________