x86cpuinfo.c 265 B

123456789101112131415
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include "osfreq.c"
  4. long long cpucycles_x86cpuinfo(void)
  5. {
  6. long long result;
  7. asm volatile(".byte 15;.byte 49" : "=A" (result));
  8. return result;
  9. }
  10. long long cpucycles_x86cpuinfo_persecond(void)
  11. {
  12. return osfreq();
  13. }