summaryrefslogtreecommitdiff
path: root/nacl/cpucycles/x86cpuspeed.c
diff options
context:
space:
mode:
Diffstat (limited to 'nacl/cpucycles/x86cpuspeed.c')
-rw-r--r--nacl/cpucycles/x86cpuspeed.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/nacl/cpucycles/x86cpuspeed.c b/nacl/cpucycles/x86cpuspeed.c
deleted file mode 100644
index 34222565..00000000
--- a/nacl/cpucycles/x86cpuspeed.c
+++ /dev/null
@@ -1,24 +0,0 @@
1#include <stdio.h>
2#include <sys/types.h>
3#include <sys/param.h>
4#include <sys/sysctl.h>
5
6long long cpucycles_x86cpuspeed(void)
7{
8 long long result;
9 asm volatile(".byte 15;.byte 49" : "=A" (result));
10 return result;
11}
12
13long long cpucycles_x86cpuspeed_persecond(void)
14{
15 int oid[2];
16 int val;
17 size_t size;
18 oid[0] = CTL_HW;
19 oid[1] = HW_CPUSPEED;
20 size = sizeof val;
21 if (sysctl(oid,2,&val,&size,0,0) == -1) return 0;
22 if (size != sizeof val) return 0;
23 return val * 1000000LL;
24}