DSPRelated.com
Forums

Fwd: Re: [code-comp] How to speed up profiling

Started by Yong Yang April 30, 2004
HI, ganesh
 
Do i have to enable clock as well when using TIMER_getCount()? If i enable it, the same error message (invalid CIO command) comes out.
 
Thank you
 
Yong

Note: forwarded message attached.



Date:  Fri Apr 30, 2004  3:20 am
Subject:  Re: [code-comp] How to speed up profiling
To:  Ganesh Vijayan <>

HI, Ganesh

Thanks for your answer. When i use TIMER_getCount() as you suggested, i always get 0. I have read through the help docoment about CSL, configured CDB file, used TIMER_start(). Anything else needed to be done to get it work?

Thank you

Yong

Ganesh Vijayan <g...@emuzed.com> wrote:

Hi Yong,
Sorry I couldn't reply to your earlier mail as I was busy with some other stuff.
I would discourage you from employing clock because it would be disadvantageous in case you wish that your application is repetitive.
In the sense, if you forget to Enable Clock from the Profiler menu, it wouldn't generate any stuff.
 
Coming to your problem, it has been a known problem that cio (Console I/O) module always has given problems to developers be it on any platform.
I would suggest you to create a separate memory section either in SDRAM or ISRAM but with a different name and space enough for only cio module. (You can know the space reqd. from the map file generated with earlier memory configurations). Place CIO in this section and I presume you shouldn't have any other problems regarding the same.
 
On the other hand, a simple and straight solution would be to use the TIMER module instead. Include csl (It will anyways be included already). Use the Timer module. You need to define the TIMER_Handle, Unsigned long variables to hold the values. You can find more information on using the same in the CSL documentation. Use TIMER_getCount which can make your application run independently i.e. in terms of the IDE and profiling.
 
Hope this helps.
Thanks and Regards,
Ganesh
 

----- Original Message -----
From: Yong Yang
To: piyush kaul
Cc: c...@yahoogroups.com ; c...@yahoogroups.com
Sent: Thursday, April 29, 2004 7:32 AM
Subject: Re: [code-comp] How to speed up profiling

Hi, Piyush
 
Thanks for your answer
 
When i enable the clock by going to the menu Profiler->Enable Clock and run the program again, the stdout window says invalid CIO command(17). There's no such problem when i does not enable clock. Can you tell me what's wrong.
 
Thank you
 
Yongpiyush kaul <p...@yahoo.com> wrote:
Hi Yong,

The method is OK. Maybe you forgot to enable the clock
by going to the menu Profiler->Enable Clock.
As I suggested earlier, working with timer registers,
using CSL macros might be a little more efficient. The
flow would be the same as you use with clock(), but
instead TIMER macros would be used to get timer count
values.//I would modify your code to give an example
main()
{
//Assuming that you configure the timer 2 in CDB
//For each frame restart the counter,
// to avoid wraparound problems
TIMER_FSET(CTL2,HLD,1);
TIMER_FSET(CTL2,GO,1);
DecodeFrame()
frameTime = TIMER_RGET(CNT2);//Total time for

//eachframe
}

//Then for each function
func1
{
unsigned int start, stop;
static unsigned int sum = 0; //the function costs
static int enter_c = 0; //to count the times the
start TIMER_RGET(CNT2);//clock_t start=clock();

// function is called
//yy end

//At the end of every function, i put
//yy added, record is a structure
//
record[0].n= ++enter_c;
stop = TIMER_RGET(CNT2);//stop = clock();
sum += stop-start-overhead_c;
record[0].t = sum;
}

Regards
Piyush

--- Yong Yang wrote:
> Hi, Piyush, Ganesh and all
>
> I used clock() function to profile my encoder.
> At the start of every function, i put
> //yy
> clock_t start=clock();
> clock_t stop;
> static clock_t sum = 0; //to sum up total time the
> function costs
> static int enter_c = 0; //to count the times the
> function is called
> //yy end
>
> At the end of every function, i put
> //yy added, record is a structure
> //
> record[0].n= ++enter_c;
> stop = clock();
> sum += stop-start-overhead_c;
> record[0].t sum;
> //yy> struct record_type
> {
> clock_t t; //count time
> int n; //count the times the function is called
> }> At the end of main(), i write record to a file.
>
> I find it run very slow, even if i only profile a
> few functions. And another question is the total
> time is almost 0, although the function has been
> called a few hundred times.
>
> Can you tell me how you write the efficient code?
> Thank you
>
> Yong
>
> piyush kaul wrote:
> Hi Yong,
>
> One method (suggested by TI people) which I have
> started using for my video decoder is to use the
> timer
> register and do intrusive instrumentation of the
> major
> functions of the code. There is a slight overhead of
> using the timer, but overall it is would run in the
> same as without profiling. Also you will be able to
> run the code without any debug option (e.g. function
> profile debug), so it would be as optimized as the
> final version.> Regards
> Piyush
>
> --- Yong Yang wrote:
> > Hi, all
> >
> > I am profiling my video encoder program on TI
> DM642
> > EVM. It's extremely slow. 17 hours has passed but
> it
> > even has not encoded one frame! Any way to speed
> it
> > up?
> >
> > Thank you
> > Yong
> >
> >
> > ---------------------------------
> >
>
> =====
> **************************************
> And---"A blind Understanding!" Heav'n replied.
>
> Piyush Kaul
> http://www.geocities.com/piyushkaul>
>
> __________________________________> ---------------------------------
>
=====
**************************************
And---"A blind Understanding!" Heav'n replied.

Piyush Kaul
http://www.geocities.com/piyushkaul

__________________________________

Win a $20,000 Career Makeover at Yahoo! HotJobs


Hi Yong,
You need to perform initialization steps for the Timer Module before you can start the module.
Also send across your code, if possible. I will try and see what is the mistake you are committing.
BTW, you needn't enable the clock. The clock is enabled through the Software only.
HTH,
Ganesh
----- Original Message -----
From: Yong Yang
To: Ganesh Vijayan
Cc: c...@yahoogroups.com ; c...@yahoogroups.com
Sent: Friday, April 30, 2004 9:45 AM
Subject: [c6x] Fwd: Re: [code-comp] How to speed up profiling

HI, ganesh
 
Do i have to enable clock as well when using TIMER_getCount()? If i enable it, the same error message (invalid CIO command) comes out.
 
Thank you
 
Yong

Note: forwarded message attached.



Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  Send an email to c...@yahoogroups.com

To Post:  Send an email to c...@yahoogroups.com

To Leave: Send an email to c...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/c6x

Other Groups: http://www.dsprelated.com





Hi, Ganesh
 
My code in main()
 
Uint32 start, stop;
CSL_cfgInit();  //initialization  function generated by CDB
TIMER_start(hTimer1);
start = TIMER_getCount(hTimer1);
 
.....//other code

stop = TIMER_getCount(hTimer1);
printf("start: %d\n", start);
printf("stop: %d\n", stop);
printf("cycles: %d\n", stop - start);
 
in videocfg_c.c generated by CDB file
 
void CSL_cfgInit()
{
    hTimer1 = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET);
    TIMER_config(hTimer1, &timerCfg0);
}
 
thanks
Yong

Ganesh Vijayan <g...@emuzed.com> wrote:
Hi Yong,
You need to perform initialization steps for the Timer Module before you can start the module.
Also send across your code, if possible. I will try and see what is the mistake you are committing.
BTW, you needn't enable the clock. The clock is enabled through the Software only.
HTH,
Ganesh
----- Original Message -----
From: Yong Yang
To: Ganesh Vijayan
Cc: c...@yahoogroups.com ; c...@yahoogroups.com
Sent: Friday, April 30, 2004 9:45 AM
Subject: [c6x] Fwd: Re: [code-comp] How to speed up profiling

HI, ganesh
 
Do i have to enable clock as well when using TIMER_getCount()? If i enable it, the same error message (invalid CIO command) comes out.
 
Thank you
 
Yong

Note: forwarded message attached.



Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  Send an email to c...@yahoogroups.com

To Post:  Send an email to c...@yahoogroups.com

To Leave: Send an email to c...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/c6x

Other Groups: http://www.dsprelated.com




Hi Yong,
Did you set the configuration parameters for the module properly ? Are you using the correct CSL for the chip ?
Have you set the parameters of timercfg0 correctly ?
Perform a reset timer before you config your timer i.e. TIMER_config.
Also one more important thing is that you need to multiply the difference by 8 i.e. any output from the TIMER module is scaled down by 8. You are missing the multiplication by 8.
Kindly verify the same.
Thanks and Regards,
Ganesh
----- Original Message -----
From: Yong Yang
To: Ganesh Vijayan
Cc: c...@yahoogroups.com ; c...@yahoogroups.com
Sent: Friday, April 30, 2004 11:54 AM
Subject: Re: [c6x] Fwd: Re: [code-comp] How to speed up profiling

Hi, Ganesh
 
My code in main()
 
Uint32 start, stop;
CSL_cfgInit();  //initialization  function generated by CDB
TIMER_start(hTimer1);
start = TIMER_getCount(hTimer1);
 
.....//other code

stop = TIMER_getCount(hTimer1);
printf("start: %d\n", start);
printf("stop: %d\n", stop);
printf("cycles: %d\n", stop - start);
 
in videocfg_c.c generated by CDB file
 
void CSL_cfgInit()
{
    hTimer1 = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET);
    TIMER_config(hTimer1, &timerCfg0);
}
 
thanks
Yong



Hi, Ganesh
 
I use default configuration parameters for the module , see below
 
timerCfg0
INput Clock Source(CLKSRC)              External Source
Cl;ock/Pulse Mode(CP)                          Pulse mode
Pulse Width (PWID)                                 one clock cycle
Function of TOUT(FUNC)                     General_Purse Output
  DAta Oputput(TOUT pin)                    0
  TOUT Inverter Control(INVOUT)   Uninverted
  TINP Inverter Control(INVINP)     Uninverted
Timer Operation                                       Hold
Period Value                                               0x0
Counter Value                                            0x0
Control REgister(CTL)                            0x0
Period Register(PRD)                             0x0
Counter REgister(CNT)                          0x0
 
Timer_Device1
Open Timer Device                     True
Handle                                             hTimer1
Enable Pre-INitailization        True
Pre-INitailize with                     TimerCfg0

Thanks

Yong


 
Ganesh Vijayan <g...@emuzed.com> wrote:
Hi Yong,
Did you set the configuration parameters for the module properly ? Are you using the correct CSL for the chip ?
Have you set the parameters of timercfg0 correctly ?
Perform a reset timer before you config your timer i.e. TIMER_config.
Also one more important thing is that you need to multiply the difference by 8 i.e. any output from the TIMER module is scaled down by 8. You are missing the multiplication by 8.
Kindly verify the same.
Thanks and Regards,
Ganesh
----- Original Message -----
From: Yong Yang
To: Ganesh Vijayan
Cc: c...@yahoogroups.com ; c...@yahoogroups.com
Sent: Friday, April 30, 2004 11:54 AM
Subject: Re: [c6x] Fwd: Re: [code-comp] How to speed up profiling

Hi, Ganesh
 
My code in main()
 
Uint32 start, stop;
CSL_cfgInit();  //initialization  function generated by CDB
TIMER_start(hTimer1);
start = TIMER_getCount(hTimer1);
 
.....//other code

stop = TIMER_getCount(hTimer1);
printf("start: %d\n", start);
printf("stop: %d\n", stop);
printf("cycles: %d\n", stop - start);
 
in videocfg_c.c generated by CDB file
 
void CSL_cfgInit()
{
    hTimer1 = TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET);
    TIMER_config(hTimer1, &timerCfg0);
}
 
thanks
Yong



Hi Yong,
Change the parameters to the following and verify:
Control register : 0x000002c0
Period register: 0xffffffff
Count register: 0x00000000
Also you can perform TIMER_reset(hTimer) as even though it might open the timer in Reset mode, manually performing a reset won't harm.
Try these. It should definitely help.
Ganesh
 
----- Original Message -----
From: Yong Yang
Sent: Friday, April 30, 2004 1:23 PM
Subject: Fwd: Re: [c6x] Fwd: Re: [code-comp] How to speed up profiling

HI, Ganesh
 
A typo
Control Register (CTL) is 0x200 instead of 0x0
 
You said output of TIMER_getCount should be multiplied by 8. Is it because you set Input Clock Source(CLKSRC) to (CPU clock)/8? Can i use the default value "External Source"?
 
I think the timer device has been reset by TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET )
The 2nd parameter TIMER_OPEN_RESET does it.
 
Thanks
 
Yong

Note: forwarded message attached.



Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  Send an email to c...@yahoogroups.com

To Post:  Send an email to c...@yahoogroups.com

To Leave: Send an email to c...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/c6x

Other Groups: http://www.dsprelated.com





Hi, Ganesh
 
I tried these, but unfortunately all TIMER_getCount() values are still 0. I tried TIMER_setCount(htimer1, 0x55), then TIMER_getCount(htimer1), the value is 0x55. It seems the timer register remains constant and doesn't increment at all.
 
Thanks
Yong

Ganesh Vijayan <g...@emuzed.com> wrote:
Hi Yong,
Change the parameters to the following and verify:
Control register : 0x000002c0
Period register: 0xffffffff
Count register: 0x00000000
Also you can perform TIMER_reset(hTimer) as even though it might open the timer in Reset mode, manually performing a reset won't harm.
Try these. It should definitely help.
Ganesh
 
----- Original Message -----
From: Yong Yang
Sent: Friday, April 30, 2004 1:23 PM
Subject: Fwd: Re: [c6x] Fwd: Re: [code-comp] How to speed up profiling

HI, Ganesh
 
A typo
Control Register (CTL) is 0x200 instead of 0x0
 
You said output of TIMER_getCount should be multiplied by 8. Is it because you set Input Clock Source(CLKSRC) to (CPU clock)/8? Can i use the default value "External Source"?
 
I think the timer device has been reset by TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET )
The 2nd parameter TIMER_OPEN_RESET does it.
 
Thanks
 
Yong

Note: forwarded message attached.



Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  Send an email to c...@yahoogroups.com

To Post:  Send an email to c...@yahoogroups.com

To Leave: Send an email to c...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/c6x

Other Groups: http://www.dsprelated.com




Hi Yong,
I cant comprehend why you are facing this . Instead of setting the TIMER in CSL set in software and check...
Ganesh
----- Original Message -----
From: Yong Yang
To: Ganesh Vijayan
Cc: c...@yahoogroups.com ; c...@yahoogroups.com ; t...@psl.com.sg
Sent: Friday, April 30, 2004 2:49 PM
Subject: Re: Re: [c6x] Fwd: Re: [code-comp] How to speed up profiling

Hi, Ganesh
 
I tried these, but unfortunately all TIMER_getCount() values are still 0. I tried TIMER_setCount(htimer1, 0x55), then TIMER_getCount(htimer1), the value is 0x55. It seems the timer register remains constant and doesn't increment at all.
 
Thanks
Yong

Ganesh Vijayan <g...@emuzed.com> wrote:
Hi Yong,
Change the parameters to the following and verify:
Control register : 0x000002c0
Period register: 0xffffffff
Count register: 0x00000000
Also you can perform TIMER_reset(hTimer) as even though it might open the timer in Reset mode, manually performing a reset won't harm.
Try these. It should definitely help.
Ganesh
 
----- Original Message -----
From: Yong Yang
Sent: Friday, April 30, 2004 1:23 PM
Subject: Fwd: Re: [c6x] Fwd: Re: [code-comp] How to speed up profiling

HI, Ganesh
 
A typo
Control Register (CTL) is 0x200 instead of 0x0
 
You said output of TIMER_getCount should be multiplied by 8. Is it because you set Input Clock Source(CLKSRC) to (CPU clock)/8? Can i use the default value "External Source"?
 
I think the timer device has been reset by TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET )
The 2nd parameter TIMER_OPEN_RESET does it.
 
Thanks
 
Yong

Note: forwarded message attached.



Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  Send an email to c...@yahoogroups.com

To Post:  Send an email to c...@yahoogroups.com

To Leave: Send an email to c...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/c6x

Other Groups: http://www.dsprelated.com




Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  Send an email to c...@yahoogroups.com

To Post:  Send an email to c...@yahoogroups.com

To Leave: Send an email to c...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/c6x

Other Groups: http://www.dsprelated.com





Hi, Ganesh
 
I don't get clearly what you mean by this
 
Thanks
 
Yong

Ganesh Vijayan <g...@emuzed.com> wrote:
Hi Yong,
I cant comprehend why you are facing this . Instead of setting the TIMER in CSL set in software and check...
Ganesh
----- Original Message -----
From: Yong Yang
To: Ganesh Vijayan
Cc: c...@yahoogroups.com ; c...@yahoogroups.com ; t...@psl.com.sg
Sent: Friday, April 30, 2004 2:49 PM
Subject: Re: Re: [c6x] Fwd: Re: [code-comp] How to speed up profiling

Hi, Ganesh
 
I tried these, but unfortunately all TIMER_getCount() values are still 0. I tried TIMER_setCount(htimer1, 0x55), then TIMER_getCount(htimer1), the value is 0x55. It seems the timer register remains constant and doesn't increment at all.
 
Thanks
Yong

Ganesh Vijayan <g...@emuzed.com> wrote:
Hi Yong,
Change the parameters to the following and verify:
Control register : 0x000002c0
Period register: 0xffffffff
Count register: 0x00000000
Also you can perform TIMER_reset(hTimer) as even though it might open the timer in Reset mode, manually performing a reset won't harm.
Try these. It should definitely help.
Ganesh
 
----- Original Message -----
From: Yong Yang
Sent: Friday, April 30, 2004 1:23 PM
Subject: Fwd: Re: [c6x] Fwd: Re: [code-comp] How to speed up profiling

HI, Ganesh
 
A typo
Control Register (CTL) is 0x200 instead of 0x0
 
You said output of TIMER_getCount should be multiplied by 8. Is it because you set Input Clock Source(CLKSRC) to (CPU clock)/8? Can i use the default value "External Source"?
 
I think the timer device has been reset by TIMER_open(TIMER_DEV1, TIMER_OPEN_RESET )
The 2nd parameter TIMER_OPEN_RESET does it.
 
Thanks
 
Yong

Note: forwarded message attached.



Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  Send an email to c...@yahoogroups.com

To Post:  Send an email to c...@yahoogroups.com

To Leave: Send an email to c...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/c6x

Other Groups: http://www.dsprelated.com




Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  Send an email to c...@yahoogroups.com

To Post:  Send an email to c...@yahoogroups.com

To Leave: Send an email to c...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/c6x

Other Groups: http://www.dsprelated.com