gsdx-linux: disable perf monitor on release build

Code is rather slow on linux. Expect a 5-10% perf increase
This commit is contained in:
Gregory Hainaut 2015-08-10 08:33:39 +02:00
parent 76d84bf6a5
commit 0663501d6f
2 changed files with 12 additions and 0 deletions

View File

@ -35,6 +35,7 @@ GSPerfMon::GSPerfMon()
void GSPerfMon::Put(counter_t c, double val) void GSPerfMon::Put(counter_t c, double val)
{ {
#ifndef DISABLE_PERF_MON
if(c == Frame) if(c == Frame)
{ {
#ifdef __linux__ #ifdef __linux__
@ -60,10 +61,12 @@ void GSPerfMon::Put(counter_t c, double val)
{ {
m_counters[c] += val; m_counters[c] += val;
} }
#endif
} }
void GSPerfMon::Update() void GSPerfMon::Update()
{ {
#ifndef DISABLE_PERF_MON
if(m_count > 0) if(m_count > 0)
{ {
for(size_t i = 0; i < countof(m_counters); i++) for(size_t i = 0; i < countof(m_counters); i++)
@ -75,25 +78,30 @@ void GSPerfMon::Update()
} }
memset(m_counters, 0, sizeof(m_counters)); memset(m_counters, 0, sizeof(m_counters));
#endif
} }
void GSPerfMon::Start(int timer) void GSPerfMon::Start(int timer)
{ {
#ifndef DISABLE_PERF_MON
m_start[timer] = __rdtsc(); m_start[timer] = __rdtsc();
if(m_begin[timer] == 0) if(m_begin[timer] == 0)
{ {
m_begin[timer] = m_start[timer]; m_begin[timer] = m_start[timer];
} }
#endif
} }
void GSPerfMon::Stop(int timer) void GSPerfMon::Stop(int timer)
{ {
#ifndef DISABLE_PERF_MON
if(m_start[timer] > 0) if(m_start[timer] > 0)
{ {
m_total[timer] += __rdtsc() - m_start[timer]; m_total[timer] += __rdtsc() - m_start[timer];
m_start[timer] = 0; m_start[timer] = 0;
} }
#endif
} }
int GSPerfMon::CPU(int timer, bool reset) int GSPerfMon::CPU(int timer, bool reset)

View File

@ -45,6 +45,10 @@
#endif #endif
//#define ENABLE_OGL_DEBUG_MEM_BW // compute the quantity of data transfered (debug purpose) //#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 #ifdef _WINDOWS
//#define ENABLE_OPENCL //#define ENABLE_OPENCL
#endif #endif