diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2016-01-01 13:17:37 +0100 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2016-01-01 13:17:37 +0100 |
commit | d192d8c017492a740353780d115bd4fc6cec20e9 (patch) | |
tree | cd2d750436675e65abcbebd74168ff4159aab4b4 | |
parent | db94df5f9c6c88b7b1f6601c35811a4d99184c0f (diff) |
benchmark: Fix cpuid clobbering
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r-- | include/gapk/get_cycles.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/gapk/get_cycles.h b/include/gapk/get_cycles.h index ec530fc..9eb7bc3 100644 --- a/include/gapk/get_cycles.h +++ b/include/gapk/get_cycles.h @@ -52,7 +52,7 @@ static inline cycles_t get_cycles() struct timespec ts; #if defined (__x86_64__) || defined(__i386__) - asm volatile ("cpuid"); /* flush pipeline */ + asm volatile ("cpuid" : : : "eax", "ebx", "ecx", "edx" ); /* flush pipeline */ #endif clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); return ts.tv_nsec; @@ -68,7 +68,7 @@ static inline cycles_t get_cycles() { unsigned low, high; unsigned long long val; - asm volatile ("cpuid"); /* flush pipeline */ + asm volatile ("cpuid" : : : "eax", "ebx", "ecx", "edx" ); /* flush pipeline */ asm volatile ("rdtsc" : "=a" (low), "=d" (high)); val = high; val = (val << 32) | low; |