From: Andi Kleen Add sched_clock for x86-64 to make test3-mm1 compile. This could have overflow issues, the calculation is done in 32bits only with an multiply. But I hope it's good enough for the scheduler arch/x86_64/kernel/time.c | 13 +++++++++++++ 1 files changed, 13 insertions(+) diff -puN arch/x86_64/kernel/time.c~x86_64-sched_clock arch/x86_64/kernel/time.c --- 25/arch/x86_64/kernel/time.c~x86_64-sched_clock 2003-08-23 13:57:14.000000000 -0700 +++ 25-akpm/arch/x86_64/kernel/time.c 2003-08-23 13:57:14.000000000 -0700 @@ -370,6 +370,19 @@ static irqreturn_t timer_interrupt(int i return IRQ_HANDLED; } +/* RED-PEN: calculation is done in 32bits with multiply for performance + and could overflow, it may be better (but slower)to use an 64bit division. */ +unsigned long long sched_clock(void) +{ + unsigned long a; + + if (__vxtime.mode == VXTIME_HPET) + return (hpet_readl(HPET_COUNTER) * vxtime.quot) >> 32; + + rdtscll(a); + return (a * vxtime.tsc_quot) >> 32; +} + unsigned long get_cmos_time(void) { unsigned int timeout, year, mon, day, hour, min, sec; _