diff options
Diffstat (limited to 'nacl/cpucycles/amd64cpuinfo.c')
-rw-r--r-- | nacl/cpucycles/amd64cpuinfo.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nacl/cpucycles/amd64cpuinfo.c b/nacl/cpucycles/amd64cpuinfo.c new file mode 100644 index 00000000..729f2612 --- /dev/null +++ b/nacl/cpucycles/amd64cpuinfo.c | |||
@@ -0,0 +1,16 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <sys/types.h> | ||
3 | #include "osfreq.c" | ||
4 | |||
5 | long long cpucycles_amd64cpuinfo(void) | ||
6 | { | ||
7 | unsigned long long result; | ||
8 | asm volatile(".byte 15;.byte 49;shlq $32,%%rdx;orq %%rdx,%%rax" | ||
9 | : "=a" (result) :: "%rdx"); | ||
10 | return result; | ||
11 | } | ||
12 | |||
13 | long long cpucycles_amd64cpuinfo_persecond(void) | ||
14 | { | ||
15 | return osfreq(); | ||
16 | } | ||