Created
October 3, 2014 23:49
-
-
Save matutter/77cace00e269345cef73 to your computer and use it in GitHub Desktop.
complete cycles counter
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
| #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