SIMLIB/C++ 3.09
Loading...
Searching...
No Matches
rdtsc.h
Go to the documentation of this file.
1/*
2 * rdtsc.h
3 * -----------------------------------------------------------------
4 * function for reading 64 bit timer (x86: Pentium, K6, etc.)
5 * for GNU C/C++ only
6 *
7 */
8#ifndef __GNUC__
9#error "Use GNU C, please"
10#endif
11
12// universal x86, x86-64 code:
13static __inline__ unsigned long long rdtsc(void)
14{
15 unsigned a, d;
16 __asm volatile ( "rdtsc" : "=a" (a), "=d" (d) ); // compiler-dependent
17 return ((unsigned long long) a) | (((unsigned long long) d) << 32);
18}
19
static __inline__ unsigned long long rdtsc(void)
Definition: rdtsc.h:13