Skip to contentSkip to conversation

get_cycles()

DISCUSSION Kevin Diggs 3 participants 6 messages Apr 26, 2008 – Apr 28, 2008

lore
Share & tools
lore
#0 lore raw

H,

Anyone know how to turn get_cycles() into an actual time in a module?
ppc_tb_freq does not seem to be exported?

kevin

#1 lore raw

From: Kevin Diggs <[email protected]>
Date: Sat, 26 Apr 2008 00:54:11 -0700

Quoted 2 lines

Anyone know how to turn get_cycles() into an actual time in a module?
ppc_tb_freq does not seem to be exported?

You should really be using ktime_t and associated interfaces.

#2 lore raw
Quoted 10 lines · David Miller

From: Kevin Diggs <[email protected]>
Date: Sat, 26 Apr 2008 00:54:11 -0700

Quoted 2 lines

Anyone know how to turn get_cycles() into an actual time in a module?
ppc_tb_freq does not seem to be exported?

You should really be using ktime_t and associated interfaces.

This looks pretty cool ... but I don't want to create a dependency on hrtimer.

So ... How expensive would it be to export ppc_tb_freq? Or add a get_cycles_tb() function?

kevin

#3 lore raw

From: Kevin Diggs <[email protected]>
Date: Sat, 26 Apr 2008 19:39:07 -0700

Quoted 2 lines

This looks pretty cool ... but I don't want to create a dependency on hrtimer.

It doesn't create such a dependency.

We use it unconditionally in the generic networking.

Please don't use platform specific interfaces if you don't have to. You're be insulated from so many things.

#4 lore raw
Quoted 8 lines · David Miller

From: Kevin Diggs <[email protected]>
Date: Sat, 26 Apr 2008 19:39:07 -0700

Quoted 2 lines

This looks pretty cool ... but I don't want to create a dependency on hrtimer.

Quoted 7 lines

It doesn't create such a dependency.

We use it unconditionally in the generic networking.

Please don't use platform specific interfaces if you don't have to. You're be insulated from so many things.

I'm working on a cpufreq driver for the 750GX so I don't think I have to worry about being to platform specific.

Would a compile time configuration be a good idea (hrtimer or get_cycles() assisted timing)?

In the 2.4 code I just used a timer 2 ticks in the future to be certain I did not go under the 100 us PLL lock delay. I was trying to see if I could cut the latency down.

What about using OF? Isn't there a timebase property for the cpus?

Thoughts?

kevin

#5 lore raw
Quoted 5 lines · Kevin Diggs

I'm working on a cpufreq driver for the 750GX so I don't think I have to worry about being to platform specific.

Would a compile time configuration be a good idea (hrtimer or get_cycles() assisted timing)?

Save yourself the pain, and use the hrtimers infrastructure.

Quoted 5 lines

In the 2.4 code I just used a timer 2 ticks in the future to be certain I did not go under the 100 us PLL lock delay. I was trying to see if I could cut the latency down.

What about using OF? Isn't there a timebase property for the cpus?

Sure, If you really don't want to use the infrastructure that's there feel free to duplicate portions of arch/powerpc/kernel/time.c and kernel/time/* into your cpufreq driver.

Yours Tony

linux.conf.au http://www.marchsouth.org/
Jan 19 - 24 2009 The Australian Linux Technical Conference!