RE: DSP Cycles measurement on DM6467

2009-04-17 Thread Griffis, Brad
Prasad,

The high resolution clock that DSP/BIOS uses on 64x+ architecture is called the 
time-stamp counter (TSC), which is part of the 64x+ Megamodule.  It's a 64-bit 
counter consisting of two registers, TSCH and TSCL, that operate at CPU/1.  
When you call CLK_gethtime it reads TSCL.

By default TSC does not count.  The software needs to do a dummy write to TSCL 
to make it start.  In my experience that is always done automatically by BIOS.  
Perhaps in your BIOS configuration something turned it off.  Make sure that 
bios.CLK.ENABLEHTIME = 1 in your tcf.  That is the default value, so unless 
someone explicitly set it to 0 somewhere it should be on.  That seems the most 
likely config option to affect this.

Once you enable that option you should see CLK_cpuCyclesPerHtime return 1 since 
the TSC counts at CPU/1.

Brad

-Original Message-
From: davinci-linux-open-source-boun...@linux.davincidsp.com 
[mailto:davinci-linux-open-source-boun...@linux.davincidsp.com] On Behalf Of 
Joshi, Prasad
Sent: Friday, April 17, 2009 4:21 AM
To: davinci-linux-open-source@linux.davincidsp.com
Subject: DSP Cycles measurement on DM6467


I want to measure DSP cycles consumed in a function. 
what i am doing is as follows.



time1 = CLK_gethtime();
function()
{

//some code

}
time2 = CLK_gethtime();
DSP_Cycles = (time2- time1) * (CLK_cpuCyclesPerHtime())



When i print DSP_Cycles, it gives zero. 
Then i tried printing (CLK_cpuCyclesPerHtime()) directly & found that it is 
returning zero.


CLK_cpuCyclesPerHtime() returns a Float value.
I tried printing it with %f, %32.3g %ld (After type proper casting), but every 
time it is prinintg zero.

I have added all header files (bios/include/log.h, bios/include/clk.h, 
bios/include/gbl.h) & CLK is initialised too.

Can anyone tell where am I making mistake?




Thanks & Regards
Prasad V. Joshi
Texas Instruments
Off: 080-25099173
 
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: DSP Cycles measurement on DM6467

2009-04-19 Thread Balagopalakrishnan, Anand
Before accessing the TSC registers, you need to enable them by calling:
TSC_enable();

To get the DSP cycles, the best option is to use TSC_read(). This returns a 64 
bit unsigned int containing the value of both TSCH and TSCL registers.

Regards,
Anand

-Original Message-
From: davinci-linux-open-source-boun...@linux.davincidsp.com 
[mailto:davinci-linux-open-source-boun...@linux.davincidsp.com] On Behalf Of 
Griffis, Brad
Sent: Friday, April 17, 2009 10:53 PM
To: Joshi, Prasad; davinci-linux-open-source@linux.davincidsp.com
Subject: RE: DSP Cycles measurement on DM6467

Prasad,

The high resolution clock that DSP/BIOS uses on 64x+ architecture is called the 
time-stamp counter (TSC), which is part of the 64x+ Megamodule.  It's a 64-bit 
counter consisting of two registers, TSCH and TSCL, that operate at CPU/1.  
When you call CLK_gethtime it reads TSCL.

By default TSC does not count.  The software needs to do a dummy write to TSCL 
to make it start.  In my experience that is always done automatically by BIOS.  
Perhaps in your BIOS configuration something turned it off.  Make sure that 
bios.CLK.ENABLEHTIME = 1 in your tcf.  That is the default value, so unless 
someone explicitly set it to 0 somewhere it should be on.  That seems the most 
likely config option to affect this.

Once you enable that option you should see CLK_cpuCyclesPerHtime return 1 since 
the TSC counts at CPU/1.

Brad

-Original Message-
From: davinci-linux-open-source-boun...@linux.davincidsp.com 
[mailto:davinci-linux-open-source-boun...@linux.davincidsp.com] On Behalf Of 
Joshi, Prasad
Sent: Friday, April 17, 2009 4:21 AM
To: davinci-linux-open-source@linux.davincidsp.com
Subject: DSP Cycles measurement on DM6467


I want to measure DSP cycles consumed in a function. 
what i am doing is as follows.



time1 = CLK_gethtime();
function()
{

//some code

}
time2 = CLK_gethtime();
DSP_Cycles = (time2- time1) * (CLK_cpuCyclesPerHtime())



When i print DSP_Cycles, it gives zero. 
Then i tried printing (CLK_cpuCyclesPerHtime()) directly & found that it is 
returning zero.


CLK_cpuCyclesPerHtime() returns a Float value.
I tried printing it with %f, %32.3g %ld (After type proper casting), but every 
time it is prinintg zero.

I have added all header files (bios/include/log.h, bios/include/clk.h, 
bios/include/gbl.h) & CLK is initialised too.

Can anyone tell where am I making mistake?




Thanks & Regards
Prasad V. Joshi
Texas Instruments
Off: 080-25099173
 
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: DSP Cycles measurement on DM6467

2009-04-20 Thread Steve Chen
On Mon, 2009-04-20 at 11:08 +0530, Balagopalakrishnan, Anand wrote:
> Before accessing the TSC registers, you need to enable them by
> calling:
> TSC_enable();

Which timer does TSC_enable initialize?  Would that interfere with ARM
or we don't really care about ARM for this test?


> 
> To get the DSP cycles, the best option is to use TSC_read(). This
> returns a 64 bit unsigned int containing the value of both TSCH and
> TSCL registers.
> 
> Regards,
> Anand
> 



___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source


RE: DSP Cycles measurement on DM6467

2009-04-20 Thread Balagopalakrishnan, Anand
The TSC_enable initialize the 32 bit registers - TSCL & TSCH. They are used 
only on DSP. 

Regards,
Anand

-Original Message-
From: Steve Chen [mailto:sc...@mvista.com] 
Sent: Monday, April 20, 2009 5:22 PM
To: Balagopalakrishnan, Anand
Cc: Griffis, Brad; Joshi, Prasad; davinci-linux-open-source@linux.davincidsp.com
Subject: RE: DSP Cycles measurement on DM6467

On Mon, 2009-04-20 at 11:08 +0530, Balagopalakrishnan, Anand wrote:
> Before accessing the TSC registers, you need to enable them by
> calling:
> TSC_enable();

Which timer does TSC_enable initialize?  Would that interfere with ARM
or we don't really care about ARM for this test?


> 
> To get the DSP cycles, the best option is to use TSC_read(). This
> returns a 64 bit unsigned int containing the value of both TSCH and
> TSCL registers.
> 
> Regards,
> Anand
> 



___
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source