Gary -- use the "rdtsc" instruction which stands for read
timestamp counter. This instruction will return the number of cycles the
processor has been up since it was last rebooted. It is 64 bits so the
processor will turn to slag before it overflows.
Below is the inline assembly language that will compile under gcc.
__inline__ unsigned long long int rdtsc()
{
unsigned long long int x;
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
return x;
}
Note, that to get the seconds you need to divide by the speed of
the processor. Inside the kernel you can get the speed directly by using
the "cpu_khz" variable and multiple by 1000.0.
Final word, on SMP boxes each processor will have it own counter
register and because of clock drift (and slightly offset boot times) these
clocks will vary -- however, my experience is that for high-end/high-speed
systems this amount is not that noticeable -- but they will differ...
Hope that helps,
Chris
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/