Skip to content
Snippets Groups Projects
Commit c8d249cc authored by Vijay Pai's avatar Vijay Pai Committed by GitHub
Browse files

Merge pull request #11559 from vjpai/longlong

Remove long long
parents de7dec71 86a4d998
No related branches found
No related tags found
No related merge requests found
...@@ -22,26 +22,26 @@ ...@@ -22,26 +22,26 @@
#ifdef GRPC_TIMERS_RDTSC #ifdef GRPC_TIMERS_RDTSC
#if defined(__i386__) #if defined(__i386__)
static void gpr_get_cycle_counter(long long int *clk) { static void gpr_get_cycle_counter(int64_t int *clk) {
long long int ret; int64_t int ret;
__asm__ volatile("rdtsc" : "=A"(ret)); __asm__ volatile("rdtsc" : "=A"(ret));
*clk = ret; *clk = ret;
} }
// ---------------------------------------------------------------- // ----------------------------------------------------------------
#elif defined(__x86_64__) || defined(__amd64__) #elif defined(__x86_64__) || defined(__amd64__)
static void gpr_get_cycle_counter(long long int *clk) { static void gpr_get_cycle_counter(int64_t *clk) {
unsigned long long low, high; unsigned int64_t low, high;
__asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); __asm__ volatile("rdtsc" : "=a"(low), "=d"(high));
*clk = (long long)(high << 32) | (long long)low; *clk = (int64_t)(high << 32) | (int64_t)low;
} }
#endif #endif
static double cycles_per_second = 0; static double cycles_per_second = 0;
static long long int start_cycle; static int64_t start_cycle;
void gpr_precise_clock_init(void) { void gpr_precise_clock_init(void) {
time_t start; time_t start;
long long end_cycle; int64_t end_cycle;
gpr_log(GPR_DEBUG, "Calibrating timers"); gpr_log(GPR_DEBUG, "Calibrating timers");
start = time(NULL); start = time(NULL);
while (time(NULL) == start) while (time(NULL) == start)
...@@ -55,7 +55,7 @@ void gpr_precise_clock_init(void) { ...@@ -55,7 +55,7 @@ void gpr_precise_clock_init(void) {
} }
void gpr_precise_clock_now(gpr_timespec *clk) { void gpr_precise_clock_now(gpr_timespec *clk) {
long long int counter; int64_t counter;
double secs; double secs;
gpr_get_cycle_counter(&counter); gpr_get_cycle_counter(&counter);
secs = (double)(counter - start_cycle) / cycles_per_second; secs = (double)(counter - start_cycle) / cycles_per_second;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment