diff --git a/runtime/time.c b/runtime/time.c index b4c2012..284f542 100644 --- a/runtime/time.c +++ b/runtime/time.c @@ -40,6 +40,22 @@ static int __stp_cpufreq_notifier_registered = 0; STP_TIME_SYNC_INTERVAL_NOCPUFREQ) #endif +#ifdef CONFIG_CPU_CAVIUM_OCTEON +/* Octeon supports a 64 bit cycle counter we might as well use it */ +static inline cycles_t octeon_get_cycles(void) +{ + cycles_t result; + asm volatile ("rdhwr %0,$31\n" +#ifndef CONFIG_64BIT + "sll %0,0\n" +#endif + : "=r" (result)); + return result; +} +#define get_cycles octeon_get_cycles +#endif /* CONFIG_CPU_CAVIUM_OCTEON */ + + #ifndef NSEC_PER_MSEC #define NSEC_PER_MSEC 1000000L #endif