Re: [PATCH] Intel clock speed detection

Pavel Machek (pavel@elf.ucw.cz)
Sun, 28 Dec 1997 10:37:34 +0100


Hi

> Kinda makes you wonder about those motherboard benchmarks where all the
> motherboards are within a few tenths of a percent of each other. :)
>
> Compile as usual, gcc mhz.estimate.c -o mhz.estimate.
>
> #include <stdio.h>
> #include <sys/time.h>
>
> /* returns number of clock cycles since last reboot */
> __inline__ unsigned long long int rdtsc()
> {
> unsigned long long int x;
> __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
> return x;

I guess this is rdtsc instruction, which is not available on my 486
etc. You really are not going to compute 386's speed with this one.
(And this is probably while it failes on cyrix.)

Pavel

-- 
I'm really pavel@atrey.karlin.mff.cuni.cz. 	   Pavel
Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).