diff --git a/runtime/include/util.h b/runtime/include/util.h index cc3473e..d2b6be6 100644 --- a/runtime/include/util.h +++ b/runtime/include/util.h @@ -2,16 +2,16 @@ #define SFRT_UTIL_H /** - * Get CPU time in cycles using the Intel instruction rdtsc + * Get CPU time in cycles using the Intel instruction util__rdtsc * @return CPU time in cycles **/ static unsigned long long int -rdtsc(void) +util__rdtsc(void) { unsigned long long int cpu_time_in_cycles = 0; unsigned int cycles_lo; unsigned int cycles_hi; - __asm__ volatile("RDTSC" : "=a"(cycles_lo), "=d"(cycles_hi)); + __asm__ volatile("rdtsc" : "=a"(cycles_lo), "=d"(cycles_hi)); cpu_time_in_cycles = (unsigned long long int)cycles_hi << 32 | cycles_lo; return cpu_time_in_cycles; diff --git a/runtime/src/env.c b/runtime/src/env.c index 8c8d7f2..7eb2580 100644 --- a/runtime/src/env.c +++ b/runtime/src/env.c @@ -190,7 +190,7 @@ env_cos(double d) } INLINE unsigned long long -env_rdtsc(void) +env_util__rdtsc(void) { - return rdtsc(); + return util__rdtsc(); } diff --git a/runtime/src/runtime.c b/runtime/src/runtime.c index 0a449d2..179534c 100644 --- a/runtime/src/runtime.c +++ b/runtime/src/runtime.c @@ -74,7 +74,7 @@ listener_thread_main(void *dummy) while (true) { int request_count = epoll_wait(epoll_file_descriptor, epoll_events, EPOLL_MAX, -1); - u64 start_time = rdtsc(); + u64 start_time = util__rdtsc(); for (int i = 0; i < request_count; i++) { if (epoll_events[i].events & EPOLLERR) { perror("epoll_wait"); diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index e04bb69..a60e399 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -133,7 +133,7 @@ current_sandbox__build_and_send_client_response(void) done: assert(sndsz == curr->request_response_data_length); // Get End Timestamp - curr->total_time = rdtsc() - curr->start_time; + curr->total_time = util__rdtsc() - curr->start_time; printf("Function returned in %lu cycles\n", curr->total_time); #ifndef USE_HTTP_UVIO diff --git a/runtime/tests/fibonacci/get_time.h b/runtime/tests/fibonacci/get_time.h index 029b904..90abb77 100644 --- a/runtime/tests/fibonacci/get_time.h +++ b/runtime/tests/fibonacci/get_time.h @@ -17,7 +17,7 @@ get_time() unsigned long long int ret = 0; unsigned int cycles_lo; unsigned int cycles_hi; - __asm__ volatile ("RDTSC" : "=a" (cycles_lo), "=d" (cycles_hi)); + __asm__ volatile ("util__rdtsc" : "=a" (cycles_lo), "=d" (cycles_hi)); ret = (unsigned long long int)cycles_hi << 32 | cycles_lo; return ret; diff --git a/runtime/tests/work/main.c b/runtime/tests/work/main.c index a2983f6..e4d62e0 100644 --- a/runtime/tests/work/main.c +++ b/runtime/tests/work/main.c @@ -13,9 +13,9 @@ main(void) char *d = malloc(MAX_BUF + 1); int r = read(0, d, MAX_BUF); - // unsigned long long st = rdtsc(), en = 0; + // unsigned long long st = util__rdtsc(), en = 0; // wrk(); - // en = rdtsc(); + // en = util__rdtsc(); // if (r <= 0) printf("%llu\n", en > st ? (en - st)/CPU_CYCS : -1); if (r < 0) diff --git a/runtime/tests/work100k/main.c b/runtime/tests/work100k/main.c index 9a6b436..375ff7e 100644 --- a/runtime/tests/work100k/main.c +++ b/runtime/tests/work100k/main.c @@ -11,9 +11,9 @@ main(void) char *d = malloc(MAX_BUF + 1); int r = read(0, d, MAX_BUF); - // unsigned long long st = rdtsc(), en = 0; + // unsigned long long st = util__rdtsc(), en = 0; // wrk(); - // en = rdtsc(); + // en = util__rdtsc(); // if (r <= 0) printf("%llu\n", en > st ? (en - st)/CPU_CYCS : -1); if (r < 0) diff --git a/runtime/tests/work10k/main.c b/runtime/tests/work10k/main.c index 16ef960..6370306 100644 --- a/runtime/tests/work10k/main.c +++ b/runtime/tests/work10k/main.c @@ -11,9 +11,9 @@ main(void) char *d = malloc(MAX_BUF + 1); int r = read(0, d, MAX_BUF); - // unsigned long long st = rdtsc(), en = 0; + // unsigned long long st = util__rdtsc(), en = 0; // wrk(); - // en = rdtsc(); + // en = util__rdtsc(); // if (r <= 0) printf("%llu\n", en > st ? (en - st)/CPU_CYCS : -1); if (r < 0) diff --git a/runtime/tests/work1k/main.c b/runtime/tests/work1k/main.c index b46a17c..ed56018 100644 --- a/runtime/tests/work1k/main.c +++ b/runtime/tests/work1k/main.c @@ -11,9 +11,9 @@ main(void) char *d = malloc(MAX_BUF + 1); int r = read(0, d, MAX_BUF); - // unsigned long long st = rdtsc(), en = 0; + // unsigned long long st = util__rdtsc(), en = 0; // wrk(); - // en = rdtsc(); + // en = util__rdtsc(); // if (r <= 0) printf("%llu\n", en > st ? (en - st)/CPU_CYCS : -1); if (r < 0) diff --git a/runtime/tests/work1m/main.c b/runtime/tests/work1m/main.c index 5387c07..4f7f070 100644 --- a/runtime/tests/work1m/main.c +++ b/runtime/tests/work1m/main.c @@ -11,9 +11,9 @@ main(void) char *d = malloc(MAX_BUF + 1); int r = read(0, d, MAX_BUF); - // unsigned long long st = rdtsc(), en = 0; + // unsigned long long st = util__rdtsc(), en = 0; // wrk(); - // en = rdtsc(); + // en = util__rdtsc(); // if (r <= 0) printf("%llu\n", en > st ? (en - st)/CPU_CYCS : -1); if (r < 0)