mirror of https://github.com/PCSX2/pcsx2.git
GS: Switch SW renderer statistics back to rdtsc
GetCPUTicks can be pretty low resolution on some systems
This commit is contained in:
parent
c4e3bd148f
commit
603537719e
|
@ -18,6 +18,7 @@
|
|||
#include "common/emitter/cpudetect_internal.h"
|
||||
#include "common/emitter/internal.h"
|
||||
#include "common/emitter/x86_intrin.h"
|
||||
#include <atomic>
|
||||
|
||||
// CPU information support
|
||||
#if defined(_WIN32)
|
||||
|
@ -330,3 +331,17 @@ u32 x86capabilities::CalculateMHz() const
|
|||
else
|
||||
return (u32)(_CPUSpeedHz(span / 500) / 2000);
|
||||
}
|
||||
|
||||
u32 x86capabilities::CachedMHz()
|
||||
{
|
||||
static std::atomic<u32> cached{0};
|
||||
u32 local = cached.load(std::memory_order_relaxed);
|
||||
if (unlikely(local == 0))
|
||||
{
|
||||
x86capabilities caps;
|
||||
caps.Identify();
|
||||
local = caps.CalculateMHz();
|
||||
cached.store(local, std::memory_order_relaxed);
|
||||
}
|
||||
return local;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ public:
|
|||
void CountCores();
|
||||
wxString GetTypeName() const;
|
||||
|
||||
static u32 CachedMHz();
|
||||
u32 CalculateMHz() const;
|
||||
|
||||
void SIMD_EstablishMXCSRmask();
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "GS/GSCodeBuffer.h"
|
||||
|
||||
#include "GS/Renderers/SW/GSScanlineEnvironment.h"
|
||||
#include "common/General.h"
|
||||
#include "common/emitter/tools.h"
|
||||
|
||||
#include <xbyak/xbyak_util.h>
|
||||
|
||||
|
@ -109,9 +109,9 @@ public:
|
|||
totalTicks += p->ticks;
|
||||
}
|
||||
|
||||
double tick_secs = 1.0 / GetTickFrequency();
|
||||
double tick_ms = tick_secs * 1000;
|
||||
double tick_ns = tick_secs * (1000 * 1000 * 1000);
|
||||
double tick_us = 1.0 / x86capabilities::CachedMHz();
|
||||
double tick_ms = tick_us / 1000;
|
||||
double tick_ns = tick_us * 1000;
|
||||
|
||||
printf("GS stats\n");
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ void GSRasterizer::Draw(GSRasterizerData* data)
|
|||
m_pixels.total = 0;
|
||||
m_primcount = 0;
|
||||
|
||||
data->start = GetCPUTicks();
|
||||
data->start = __rdtsc();
|
||||
|
||||
m_ds->BeginDraw(data);
|
||||
|
||||
|
@ -247,7 +247,7 @@ void GSRasterizer::Draw(GSRasterizerData* data)
|
|||
|
||||
data->pixels = m_pixels.actual;
|
||||
|
||||
uint64 ticks = GetCPUTicks() - data->start;
|
||||
uint64 ticks = __rdtsc() - data->start;
|
||||
|
||||
m_pixels.sum += m_pixels.actual;
|
||||
|
||||
|
|
Loading…
Reference in New Issue