Pete's Log: intel performance register
Entry #1293, (Coding, Hacking, & CS stuff)(posted when I was 23 years old.)
I gots to record this here, because every time I want to use it, I have to do a recursive grep through my entire cse directory tree to remember when I used it before and how I used it.
To access the intel performance register that stores the number of cycles executed so far:
unsigned long long foo; __asm__ volatile (".byte 0x0f, 0x31" : "=A" (foo));
Perhaps there's a better way.