1 #ifndef _LL_ARCH_X86C_CLOCK_H
2 #define _LL_ARCH_X86C_CLOCK_H
6 // Return a monotonically increasing 64-bit clock value that wraps
7 // around no more often than once per year, and with a resolution of 1
8 // us or better (if possible). This function's availability and
9 // privileged status is architecture and configuration dependent; on
10 // x86 and x64, it is normally not privileged. On some architectures,
11 // and on older (486 and earlier) x86 chips, it will need to be
12 // supplied externally using board or kernel specific code.
14 static inline int64_t ll_getclock()
19 asm volatile("rdtsc" : "=a" (low), "=d" (high));
21 return ((int64_t)high << 32) | low;
24 static inline int32_t ll_getclock32()
27 asm volatile("rdtsc" : "=a" (clock) : : "edx");