Skip to content

Instantly share code, notes, and snippets.

@ntddk
Created July 5, 2014 17:38
Show Gist options
  • Save ntddk/abff4257ffd35bdad1d5 to your computer and use it in GitHub Desktop.
Save ntddk/abff4257ffd35bdad1d5 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdint.h>
uint64_t rdtsc(void)
{
uint64_t ret;
__asm__ volatile("rdtsc" : "=A"(ret));
return ret;
}
int main(void)
{
printf("clock conut = 0x%llx\n", rdtsc());
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment