#include
static inline unsigned long long tick()
{
unsigned long long d;
__asm__ __volatile__ (\"rdtsc\" : \"=A\" (d) );
ret
I've tried your code on several Linux distros running on different Intel CPUs (admittedly all more recent than the Pentium 4 HT 630 you appear to be using). In all those tests I got values between 25 and 50 cycles.
My only hypothesis that's consistent with all the evidence is that you're running your operating system inside a virtual machine rather than on bare metal, and TSC is getting virtualized.