Inline unsigned __int64 getcyclecount () {__ASM _EMIT 0x0F__ASM _EMIT 0X31}
// In the case where the counter is needed, you can call both GetCycleCount functions like using a normal Win32 API, compare the difference in two return values, like this: // unsigned long t; t = (unsigned long) getCyClet () ; // do something Time-Intensive ... t - = (unsigned long) getcyclecount ();
Under UNIX, I took it under FreeBSD, of course, can only be used in Pentium because INLINE long long getcyclecount () {__ASM ("RDTSC");} main () {long long count; Count = getCyClecount (); Sleep (1); Printf ("% d / n", getcyclecount () - count);}