mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
2f856f7d29
git-svn-id: file:///svn/toku/tokudb@8667 c7de825b-a66e-492c-adef-691d508d4ae1
37 lines
792 B
C
37 lines
792 B
C
// read the processor time stamp register
|
|
|
|
#if defined __ICC
|
|
|
|
#define USE_RDTSC 1
|
|
#define rdtsc _rdtsc
|
|
|
|
#elif defined __i386__
|
|
|
|
#define USE_RDTSC 1
|
|
|
|
static inline unsigned long long rdtsc() {
|
|
unsigned long hi, lo;
|
|
__asm__ __volatile__ ("rdtsc\n"
|
|
"movl %%edx,%0\n"
|
|
"movl %%eax,%1" : "=r"(hi), "=r"(lo) : : "edx", "eax");
|
|
return ((unsigned long long) hi << 32ULL) + (unsigned long long) lo;
|
|
}
|
|
|
|
#elif defined __x86_64__
|
|
|
|
#define USE_RDTSC 1
|
|
|
|
static inline unsigned long long rdtsc() {
|
|
unsigned long long r;
|
|
__asm__ __volatile__ ("rdtsc\n"
|
|
"shl $32,%%rdx\n"
|
|
"or %%rdx,%%rax\n"
|
|
"movq %%rax,%0" : "=r"(r) : : "edx", "eax", "rdx", "rax");
|
|
return r;
|
|
}
|
|
|
|
#else
|
|
|
|
#define USE_RDTSC 0
|
|
|
|
#endif
|