From ddeb1eee5c95a5f772ed224ad9b33effa2c8453d Mon Sep 17 00:00:00 2001 From: Naveen N. Rao Date: May 29 2019 21:50:24 +0000 Subject: Add support for powerpc* Use POWER's timebase register to collect timing data for the simulator via glibc's __ppc_get_timebase(). Signed-off-by: Naveen N. Rao Signed-off-by: Tulio Magno Quites Machado Filho --- diff --git a/trace_run.c b/trace_run.c index 63c5f55..4ef16c3 100644 --- a/trace_run.c +++ b/trace_run.c @@ -15,6 +15,36 @@ #include "malloc.h" #include "mtrace.h" +#ifdef __PPC__ +#include + +#define ticks_t uint64_t +/* Setting quick_run to 1 allows the simulator to model + only the allocation and deallocation accounting via + atomic_rss. The actual allocations are skipped. This + mode is useful to verify the workload file. */ +#define quick_run 0 +/* Setting record_memory_logs to 1 allows the simulator + to record real RSS, VM size, and ideal RSS into 3 + log files for later analysis. */ +#define record_memory_logs 1 + +#if record_memory_logs +FILE *vmsize_file; +FILE *vmrss_file; +FILE *ideal_rss_file; +#endif + +static __inline__ ticks_t rdtsc_s(void) +{ + return __ppc_get_timebase(); +} + +#define rdtsc_e rdtsc_s + +#else + + #if UINTPTR_MAX == 0xffffffffffffffff #define ticks_t int64_t @@ -72,6 +102,8 @@ static __inline__ ticks_t rdtsc_e(void) #endif +#endif + static ticks_t diff_timeval (struct timeval e, struct timeval s) { ticks_t usec;