Skip to content

Commit

Permalink
MIPS: Octeon: Add sched_clock() to csrc-octeon.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Daney authored and Ralf Baechle committed Jan 12, 2010
1 parent 98bea6f commit c6a3c85
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions arch/mips/cavium-octeon/csrc-octeon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c6a3c85

Please sign in to comment.