This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC 05/13] mips: Special get_cycles for cavium octeon


Originally part of a bigger patch by Victor Kamensky <kamensky@cisco.com>

Signed-off-by: Crestez Dan Leonard <cdleonard@gmail.com>
---
 runtime/time.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]