Selaa lähdekoodia

MIPS: Octeon: Add sched_clock() to csrc-octeon.c

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>
Patchwork: http://patchwork.linux-mips.org/patch/805/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
David Daney 15 vuotta sitten
vanhempi
commit
c6a3c851a2
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7 0
      arch/mips/cavium-octeon/csrc-octeon.c

+ 7 - 0
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;