1
0

amd64cpuinfo.c 324 B

12345678910111213141516
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include "osfreq.c"
  4. long long cpucycles_amd64cpuinfo(void)
  5. {
  6. unsigned long long result;
  7. asm volatile(".byte 15;.byte 49;shlq $32,%%rdx;orq %%rdx,%%rax"
  8. : "=a" (result) :: "%rdx");
  9. return result;
  10. }
  11. long long cpucycles_amd64cpuinfo_persecond(void)
  12. {
  13. return osfreq();
  14. }