79 #if (defined(__GNUC__) || defined(__ICC))
81 static inline void sctk_rdtsc_barrier(
void)
88 static inline uint64_t Timer_tsc (
void)
93 __asm__
volatile (
"mov %0=ar%1":
"=r" (t):
"i" (44));
96 #elif defined(__i686__)
97 static inline uint64_t Timer_tsc (
void)
101 unsigned long long t;
102 sctk_rdtsc_barrier();
103 __asm__
volatile (
"rdtsc":
"=A" (t));
109 #elif defined(__x86_64__)
110 static inline uint64_t Timer_tsc (
void)
116 sctk_rdtsc_barrier();
117 __asm__
volatile (
"rdtsc":
"=a" (a),
"=d" (d));
118 t = ((
unsigned long) a) | (((
unsigned long) d) << 32);
119 uint64_t ret = (uint64_t) t + Process_Sync_Offset - Process_time_origin;
124 #warning "Use get time of day for profiling, interprocess sync will not work !"
128 static inline uint64_t Timer_tsc (
void)
131 gettimeofday (&tp, NULL);
132 return tp.tv_usec + tp.tv_sec * 1000000;
137 #error Compile with GCC or ICC
uint64_t Process_time_origin
The origin of the timer.
void Timer_Init_scale(unsigned int(*real_sleep)(unsigned int))
Timer_Init_scale.
long long int Process_Sync_Offset
The offset of the timer.
double Process_timer_second
A second in the timer scale.
void Timer_set_origin()
Initializes the timer (save current processor timer counter)
void Timer_set_offset(long long int offset)
Sets the offset to apply to timer.
static double Timer_second()
Getter on the current timer scale second.