From 0663501d6fad7ef434779523467ff5a4dd194505 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Mon, 10 Aug 2015 08:33:39 +0200 Subject: [PATCH] gsdx-linux: disable perf monitor on release build Code is rather slow on linux. Expect a 5-10% perf increase --- plugins/GSdx/GSPerfMon.cpp | 8 ++++++++ plugins/GSdx/config.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/plugins/GSdx/GSPerfMon.cpp b/plugins/GSdx/GSPerfMon.cpp index b80406a220..52a82006ef 100644 --- a/plugins/GSdx/GSPerfMon.cpp +++ b/plugins/GSdx/GSPerfMon.cpp @@ -35,6 +35,7 @@ GSPerfMon::GSPerfMon() void GSPerfMon::Put(counter_t c, double val) { +#ifndef DISABLE_PERF_MON if(c == Frame) { #ifdef __linux__ @@ -60,10 +61,12 @@ void GSPerfMon::Put(counter_t c, double val) { m_counters[c] += val; } +#endif } void GSPerfMon::Update() { +#ifndef DISABLE_PERF_MON if(m_count > 0) { for(size_t i = 0; i < countof(m_counters); i++) @@ -75,25 +78,30 @@ void GSPerfMon::Update() } memset(m_counters, 0, sizeof(m_counters)); +#endif } void GSPerfMon::Start(int timer) { +#ifndef DISABLE_PERF_MON m_start[timer] = __rdtsc(); if(m_begin[timer] == 0) { m_begin[timer] = m_start[timer]; } +#endif } void GSPerfMon::Stop(int timer) { +#ifndef DISABLE_PERF_MON if(m_start[timer] > 0) { m_total[timer] += __rdtsc() - m_start[timer]; m_start[timer] = 0; } +#endif } int GSPerfMon::CPU(int timer, bool reset) diff --git a/plugins/GSdx/config.h b/plugins/GSdx/config.h index 299babaf30..830952065f 100644 --- a/plugins/GSdx/config.h +++ b/plugins/GSdx/config.h @@ -45,6 +45,10 @@ #endif //#define ENABLE_OGL_DEBUG_MEM_BW // compute the quantity of data transfered (debug purpose) +#if defined(__linux__) && !(defined(_DEBUG) || defined(_DEVEL)) +#define DISABLE_PERF_MON // Burn cycle for nothing in release mode +#endif + #ifdef _WINDOWS //#define ENABLE_OPENCL #endif