Simple Performance Counters: i386 support Export a cycles_to_ns function Signed-off-by: Christoph Lameter --- arch/i386/kernel/tsc.c | 2 +- include/asm-i386/timex.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) Index: linux-2.6.23-rc1/arch/i386/kernel/tsc.c =================================================================== --- linux-2.6.23-rc1.orig/arch/i386/kernel/tsc.c 2007-07-27 21:48:06.000000000 -0700 +++ linux-2.6.23-rc1/arch/i386/kernel/tsc.c 2007-07-27 21:50:33.000000000 -0700 @@ -118,7 +118,7 @@ unsigned long long native_sched_clock(vo 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 Index: linux-2.6.23-rc1/include/asm-i386/timex.h =================================================================== --- linux-2.6.23-rc1.orig/include/asm-i386/timex.h 2007-07-27 21:48:06.000000000 -0700 +++ linux-2.6.23-rc1/include/asm-i386/timex.h 2007-07-27 21:50:33.000000000 -0700 @@ -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