Guest User

Untitled

a guest
Apr 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. void get_cycles(unsigned *high,unsigned *low)
  2. {
  3. asm volatile ("CPUID\n\t"
  4. "RDTSC\n\t"
  5. "mov %%edx, %0\n\t"
  6. "movl %%eax, %1\n\t": "=r" (*high), "=r" (*low)::"%rax","%rbx","%rcx","%rdx"
  7. );
  8. }
  9.  
  10. static inline __attribute__((always_inline))
  11. void get_cycles_end(unsigned *high,unsigned *low){
  12.  
  13. asm volatile("RDTSCP\n\t"
  14. "mov %%edx, %0\n\t"
  15. "mov %%eax, %1\n\t"
  16. "CPUID\n\t": "=r" (*high), "=r" (*low)::"%rax","%rbx","%rcx","%rdx"
  17. );
  18. }
Add Comment
Please, Sign In to add comment