#include #include #include #include #define CPUID __asm __emit 0fh __asm __emit 0a2h #define RDTSC __asm __emit 0fh __asm __emit 031h unsigned __int64 readTSC(){ unsigned cycles_low, cycles_high; __asm { pushad CPUID RDTSC mov cycles_high, edx mov cycles_low, eax popad } return ((unsigned __int64)cycles_high << 32) | cycles_low; }