Export a cycles_to_ns function
Signed-off-by: Christoph Lameter <[email protected]>
---
arch/i386/kernel/tsc.c | 2 +-
include/asm-i386/timex.h | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index debd7db..c150ac0 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -118,7 +118,7 @@ unsigned long long native_sched_clock(void)
rdtscll(this_offset);
/* return the value in ns */
- return cycles_2_ns(this_offset);
+ return cycles_to_ns(this_offset);
}
/* We need to define a real function for sched_clock, to override the
diff --git a/include/asm-i386/timex.h b/include/asm-i386/timex.h
index 3666044..37b0338 100644
--- a/include/asm-i386/timex.h
+++ b/include/asm-i386/timex.h
@@ -19,4 +19,12 @@
extern int read_current_timer(unsigned long *timer_value);
#define ARCH_HAS_READ_CURRENT_TIMER 1
+extern long cyc2ns_scale;
+#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
+
+static inline unsigned long long cycles_to_ns(unsigned long long cyc)
+{
+ return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
+}
+
#endif
--
1.5.2.4
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]