Created
June 18, 2014 12:46
-
-
Save gaoyifan/0dd703343dd1871a8c51 to your computer and use it in GitHub Desktop.
getCPUtime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long long getCPUtime() | |
{ | |
unsigned int time_low,time_high; | |
asm("rdtsc \n\t"); | |
asm("movl %%eax, %0\n\t":"=g"(time_low)); | |
asm("movl %%edx, %0\n\t":"=g"(time_high)); | |
return ((long long)time_high << 32) | time_low; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment