19 #ifndef GRPC_CORE_LIB_GPR_TIME_PRECISE_H 20 #define GRPC_CORE_LIB_GPR_TIME_PRECISE_H 34 #if GPR_CYCLE_COUNTER_RDTSC_32 35 typedef int64_t gpr_cycle_counter;
36 inline gpr_cycle_counter gpr_get_cycle_counter() {
38 __asm__
volatile(
"rdtsc" :
"=A"(ret));
41 #elif GPR_CYCLE_COUNTER_RDTSC_64 42 typedef int64_t gpr_cycle_counter;
43 inline gpr_cycle_counter gpr_get_cycle_counter() {
45 __asm__
volatile(
"rdtsc" :
"=a"(low),
"=d"(high));
46 return (high << 32) | low;
48 #elif GPR_CYCLE_COUNTER_FALLBACK 52 typedef double gpr_cycle_counter;
53 gpr_cycle_counter gpr_get_cycle_counter();
55 #error Must define exactly one of \ 56 GPR_CYCLE_COUNTER_RDTSC_32, \ 57 GPR_CYCLE_COUNTER_RDTSC_64, or \ 58 GPR_CYCLE_COUNTER_FALLBACK gpr_timespec gpr_cycle_counter_to_time(gpr_cycle_counter cycles)
void gpr_precise_clock_now(gpr_timespec *clk)
Analogous to struct timespec.
Definition: gpr_types.h:47
gpr_timespec gpr_cycle_counter_sub(gpr_cycle_counter a, gpr_cycle_counter b)
void gpr_precise_clock_init(void)