Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined(__i386__)
- static __inline__ unsigned long long cpucycles(void)
- {
- //printf("32 bit machine");
- unsigned long long int x;
- __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
- return x;
- }
- #elif defined(__x86_64__)
- static __inline__ unsigned long long cpucycles(void)
- {
- //printf("64 bit machine");
- unsigned hi, lo;
- __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
- return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 );
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment