Skip to content

Instantly share code, notes, and snippets.

@gaoyifan
Created June 18, 2014 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaoyifan/0dd703343dd1871a8c51 to your computer and use it in GitHub Desktop.
Save gaoyifan/0dd703343dd1871a8c51 to your computer and use it in GitHub Desktop.
getCPUtime
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