Skip to content

Instantly share code, notes, and snippets.

@matutter
Created October 3, 2014 23:49
Show Gist options
  • Select an option

  • Save matutter/77cace00e269345cef73 to your computer and use it in GitHub Desktop.

Select an option

Save matutter/77cace00e269345cef73 to your computer and use it in GitHub Desktop.
complete cycles counter
#define PRSET1__ t1 = CPUCycleCounter();
#define PRSET2__ t2 = CPUCycleCounter();
#define PRDIFF__ t2 - t1
unsigned long long t1 =0, t2 =0;
static inline unsigned long long CPUCycleCounter(void) {
unsigned long long int x;
__asm__ volatile (".byte 0x0F, 0x31" : "=A" (x));
return x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment