* [PATCH] MIPS: Add sched_clock() to csrc-octeon.c
@ 2009-12-23 21:18 David Daney
2009-12-24 14:06 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: David Daney @ 2009-12-23 21:18 UTC (permalink / raw)
To: linux-mips, ralf; +Cc: David Daney
With the advent of function graph tracing on MIPS, Octeon needs a high
precision sched_clock() implementation. Without it, most timing
numbers are reported as 0.000.
This new sched_clock just uses the 64-bit cycle counter appropriately
scaled.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
arch/mips/cavium-octeon/csrc-octeon.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/arch/mips/cavium-octeon/csrc-octeon.c b/arch/mips/cavium-octeon/csrc-octeon.c
index 96110f2..96df821 100644
--- a/arch/mips/cavium-octeon/csrc-octeon.c
+++ b/arch/mips/cavium-octeon/csrc-octeon.c
@@ -50,6 +50,13 @@ static struct clocksource clocksource_mips = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+unsigned long long notrace sched_clock(void)
+{
+ return clocksource_cyc2ns(read_c0_cvmcount(),
+ clocksource_mips.mult,
+ clocksource_mips.shift);
+}
+
void __init plat_time_init(void)
{
clocksource_mips.rating = 300;
--
1.6.0.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MIPS: Add sched_clock() to csrc-octeon.c
2009-12-23 21:18 [PATCH] MIPS: Add sched_clock() to csrc-octeon.c David Daney
@ 2009-12-24 14:06 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2009-12-24 14:06 UTC (permalink / raw)
To: David Daney; +Cc: linux-mips
On Wed, Dec 23, 2009 at 01:18:54PM -0800, David Daney wrote:
> With the advent of function graph tracing on MIPS, Octeon needs a high
> precision sched_clock() implementation. Without it, most timing
> numbers are reported as 0.000.
>
> This new sched_clock just uses the 64-bit cycle counter appropriately
> scaled.
Thanks, applied!
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-24 14:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-23 21:18 [PATCH] MIPS: Add sched_clock() to csrc-octeon.c David Daney
2009-12-24 14:06 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).