chore: namespace rdtsc

main
Sean McBride 5 years ago
parent 08eb26e984
commit d6c31f6728

@ -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;

@ -190,7 +190,7 @@ env_cos(double d)
}
INLINE unsigned long long
env_rdtsc(void)
env_util__rdtsc(void)
{
return rdtsc();
return util__rdtsc();
}

@ -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");

@ -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

@ -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;

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)

Loading…
Cancel
Save