* timing in driver function
@ 2011-08-01 15:15 Michael Jones
2011-08-01 15:34 ` Gadiyar, Anand
2011-08-02 1:41 ` Paul Walmsley
0 siblings, 2 replies; 5+ messages in thread
From: Michael Jones @ 2011-08-01 15:15 UTC (permalink / raw)
To: linux-omap
I have a function in a driver which takes ~50ms to execute, which I've
measured by reading jiffies at the beginning and end. But jiffies only
counts at 128Hz on my system, so this was a very coarse measurement. Now
I would like to find out more exactly where the time is going inside
this function. So my basic question is, what is the best way to measure
lapsed time with reasonable resolution on an OMAP?
As I had done with the jiffies measurement, what I imagined was
inserting lines into my function, sampling the value of some counter at
various points within it. This approach is crude but simple and would
suffice for my case.
Since it must be a very common task, I thought I'd ask here what the
recommended approach is. I see a few directions...
1. Using the OMAP's 32kHz timer, which is provided as a "struct
clocksource". It seems like what I would want is to call
clocksource_32k.read(), but I don't know how to retrieve clocksource_32k.
2. Using the ARM core's Performance Monitor Count Registers. This seems
to be what perf_event uses. I'm not familiar with perf_events, but it
sounds like I would also need to build 'perf', which according to
http://www.omappedia.org/wiki/Using_perf isn't possible to
cross-compile. I don't want to tackle that without some reassurance that
it is the right/only way.
I am currently using a 2.6.38 kernel.
thanks,
Michael
MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Erhard Meier
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: timing in driver function
2011-08-01 15:15 timing in driver function Michael Jones
@ 2011-08-01 15:34 ` Gadiyar, Anand
2011-08-01 16:55 ` C.A, Subramaniam
2011-08-02 1:41 ` Paul Walmsley
1 sibling, 1 reply; 5+ messages in thread
From: Gadiyar, Anand @ 2011-08-01 15:34 UTC (permalink / raw)
To: Michael Jones, linux-omap@vger.kernel.org
Michael Jones wrote:
> I have a function in a driver which takes ~50ms to execute, which I've
> measured by reading jiffies at the beginning and end. But jiffies only
> counts at 128Hz on my system, so this was a very coarse measurement. Now
> I would like to find out more exactly where the time is going inside
> this function. So my basic question is, what is the best way to measure
> lapsed time with reasonable resolution on an OMAP?
>
> As I had done with the jiffies measurement, what I imagined was
> inserting lines into my function, sampling the value of some counter at
> various points within it. This approach is crude but simple and would
> suffice for my case.
>
> Since it must be a very common task, I thought I'd ask here what the
> recommended approach is. I see a few directions...
>
> 1. Using the OMAP's 32kHz timer, which is provided as a "struct
> clocksource". It seems like what I would want is to call
> clocksource_32k.read(), but I don't know how to retrieve clocksource_32k.
>
If you're looking for a one-off profiling, then as a hack, you could
export a function that unconditionally returns the value of the 32kHz
timer's count register (32KSYNCNT_CR) and use that for profiling.
- Anand
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: timing in driver function
2011-08-01 15:34 ` Gadiyar, Anand
@ 2011-08-01 16:55 ` C.A, Subramaniam
0 siblings, 0 replies; 5+ messages in thread
From: C.A, Subramaniam @ 2011-08-01 16:55 UTC (permalink / raw)
To: Gadiyar, Anand; +Cc: Michael Jones, linux-omap@vger.kernel.org
On Mon, Aug 1, 2011 at 10:34 AM, Gadiyar, Anand <gadiyar@ti.com> wrote:
> Michael Jones wrote:
>> I have a function in a driver which takes ~50ms to execute, which I've
>> measured by reading jiffies at the beginning and end. But jiffies only
>> counts at 128Hz on my system, so this was a very coarse measurement. Now
>> I would like to find out more exactly where the time is going inside
>> this function. So my basic question is, what is the best way to measure
>> lapsed time with reasonable resolution on an OMAP?
>>
>> As I had done with the jiffies measurement, what I imagined was
>> inserting lines into my function, sampling the value of some counter at
>> various points within it. This approach is crude but simple and would
>> suffice for my case.
>>
>> Since it must be a very common task, I thought I'd ask here what the
>> recommended approach is. I see a few directions...
>>
>> 1. Using the OMAP's 32kHz timer, which is provided as a "struct
>> clocksource". It seems like what I would want is to call
>> clocksource_32k.read(), but I don't know how to retrieve clocksource_32k.
>>
>
> If you're looking for a one-off profiling, then as a hack, you could
> export a function that unconditionally returns the value of the 32kHz
> timer's count register (32KSYNCNT_CR) and use that for profiling.
>
How about using GPT using dm-timer APIs?
> - Anand
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Thank you and Regards
Subbu
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: timing in driver function
2011-08-01 15:15 timing in driver function Michael Jones
2011-08-01 15:34 ` Gadiyar, Anand
@ 2011-08-02 1:41 ` Paul Walmsley
2011-08-05 12:06 ` Michael Jones
1 sibling, 1 reply; 5+ messages in thread
From: Paul Walmsley @ 2011-08-02 1:41 UTC (permalink / raw)
To: Michael Jones; +Cc: linux-omap
Hi,
On Mon, 1 Aug 2011, Michael Jones wrote:
> I have a function in a driver which takes ~50ms to execute, which I've
> measured by reading jiffies at the beginning and end. But jiffies only
> counts at 128Hz on my system, so this was a very coarse measurement. Now
> I would like to find out more exactly where the time is going inside
> this function. So my basic question is, what is the best way to measure
> lapsed time with reasonable resolution on an OMAP?
>
> As I had done with the jiffies measurement, what I imagined was
> inserting lines into my function, sampling the value of some counter at
> various points within it. This approach is crude but simple and would
> suffice for my case.
>
> Since it must be a very common task, I thought I'd ask here what the
> recommended approach is. I see a few directions...
>
> 1. Using the OMAP's 32kHz timer, which is provided as a "struct
> clocksource". It seems like what I would want is to call
> clocksource_32k.read(), but I don't know how to retrieve clocksource_32k.
Consider getnstimeofday(). It's not OMAP-specific; there are several
examples in the Linux codebase[1]; and if you use a higher-resolution
clocksource, the resolution should also increase (try disabling
CONFIG_OMAP_32K_TIMER).
1. http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git&a=search&h=HEAD&st=grep&s=getnstimeofday
- Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: timing in driver function
2011-08-02 1:41 ` Paul Walmsley
@ 2011-08-05 12:06 ` Michael Jones
0 siblings, 0 replies; 5+ messages in thread
From: Michael Jones @ 2011-08-05 12:06 UTC (permalink / raw)
To: Paul Walmsley; +Cc: linux-omap
Hi Paul,
On 08/02/2011 03:41 AM, Paul Walmsley wrote:
>
> Hi,
>
> On Mon, 1 Aug 2011, Michael Jones wrote:
>
>> I have a function in a driver which takes ~50ms to execute, which I've
>> measured by reading jiffies at the beginning and end. But jiffies only
>> counts at 128Hz on my system, so this was a very coarse measurement. Now
>> I would like to find out more exactly where the time is going inside
>> this function. So my basic question is, what is the best way to measure
>> lapsed time with reasonable resolution on an OMAP?
>>
>> As I had done with the jiffies measurement, what I imagined was
>> inserting lines into my function, sampling the value of some counter at
>> various points within it. This approach is crude but simple and would
>> suffice for my case.
>>
>> Since it must be a very common task, I thought I'd ask here what the
>> recommended approach is. I see a few directions...
>>
>> 1. Using the OMAP's 32kHz timer, which is provided as a "struct
>> clocksource". It seems like what I would want is to call
>> clocksource_32k.read(), but I don't know how to retrieve clocksource_32k.
>
> Consider getnstimeofday(). It's not OMAP-specific; there are several
> examples in the Linux codebase[1]; and if you use a higher-resolution
> clocksource, the resolution should also increase (try disabling
> CONFIG_OMAP_32K_TIMER).
>
>
> 1. http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git&a=search&h=HEAD&st=grep&s=getnstimeofday
>
>
> - Paul
Thanks, I took your suggestion and it served my purpose just fine.
-Michael
MATRIX VISION GmbH, Talstrasse 16, DE-71570 Oppenweiler
Registergericht: Amtsgericht Stuttgart, HRB 271090
Geschaeftsfuehrer: Gerhard Thullner, Werner Armingeon, Uwe Furtner, Erhard Meier
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-05 12:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01 15:15 timing in driver function Michael Jones
2011-08-01 15:34 ` Gadiyar, Anand
2011-08-01 16:55 ` C.A, Subramaniam
2011-08-02 1:41 ` Paul Walmsley
2011-08-05 12:06 ` Michael Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox