From 2986aa76f80f2857d846c0e48f508de8299052a3 Mon Sep 17 00:00:00 2001 From: Guido Cossu Date: Tue, 24 Oct 2017 13:32:02 +0100 Subject: [PATCH] Restoring Perfcounts --- lib/perfmon/PerfCount.h | 3 +-- lib/perfmon/Stat.cc | 30 ++++++++++++++---------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/perfmon/PerfCount.h b/lib/perfmon/PerfCount.h index cb27c283..73d2c70f 100644 --- a/lib/perfmon/PerfCount.h +++ b/lib/perfmon/PerfCount.h @@ -90,10 +90,9 @@ inline uint64_t cyclecount(void){ } #elif defined __x86_64__ inline uint64_t cyclecount(void){ - //return __rdtsc(); + return __rdtsc(); // unsigned int dummy; // return __rdtscp(&dummy); -return 0; // <- remove this; } #else diff --git a/lib/perfmon/Stat.cc b/lib/perfmon/Stat.cc index 75679412..3f47fd83 100644 --- a/lib/perfmon/Stat.cc +++ b/lib/perfmon/Stat.cc @@ -57,37 +57,35 @@ void PmuStat::start(void) pmu_start(); ++count; xmemctrs(&mrstart, &mwstart); - //tstart = __rdtsc(); -tstart=0; + tstart = __rdtsc(); #endif } void PmuStat::enter(int t) { #ifdef __x86_64__ - counters[0][t] = 0;//__rdpmc(0); - counters[1][t] = 0;//__rdpmc(1); - counters[2][t] = 0;//__rdpmc((1<<30)|0); - counters[3][t] = 0;//__rdpmc((1<<30)|1); - counters[4][t] = 0;//__rdpmc((1<<30)|2); - counters[5][t] = 0;//__rdtsc(); + counters[0][t] = __rdpmc(0); + counters[1][t] = __rdpmc(1); + counters[2][t] = __rdpmc((1<<30)|0); + counters[3][t] = __rdpmc((1<<30)|1); + counters[4][t] = __rdpmc((1<<30)|2); + counters[5][t] = __rdtsc(); #endif } void PmuStat::exit(int t) { #ifdef __x86_64__ - counters[0][t] = 0;//__rdpmc(0) - counters[0][t]; - counters[1][t] = 0;// __rdpmc(1) - counters[1][t]; - counters[2][t] = 0;// __rdpmc((1<<30)|0) - counters[2][t]; - counters[3][t] = 0;// __rdpmc((1<<30)|1) - counters[3][t]; - counters[4][t] = 0;// __rdpmc((1<<30)|2) - counters[4][t]; - counters[5][t] = 0;// __rdtsc() - counters[5][t]; + counters[0][t] = __rdpmc(0) - counters[0][t]; + counters[1][t] = __rdpmc(1) - counters[1][t]; + counters[2][t] = __rdpmc((1<<30)|0) - counters[2][t]; + counters[3][t] = __rdpmc((1<<30)|1) - counters[3][t]; + counters[4][t] = __rdpmc((1<<30)|2) - counters[4][t]; + counters[5][t] = __rdtsc() - counters[5][t]; #endif } void PmuStat::accum(int nthreads) { #ifdef __x86_64__ - // tend = __rdtsc(); - tend =0 ; + tend = __rdtsc(); xmemctrs(&mrend, &mwend); pmu_stop(); for (int t = 0; t < nthreads; ++t) {