GS/SW: Replace __rdtsc() with GetCPUTicks()

This commit is contained in:
Stenzek 2023-06-15 01:10:02 +10:00 committed by Connor McLaughlin
parent 85b41e23f0
commit 5d64a2b889
3 changed files with 10 additions and 7 deletions

View File

@ -96,7 +96,7 @@ public:
}
}
virtual void PrintStats()
void PrintStats()
{
u64 totalTicks = 0;
@ -106,7 +106,7 @@ public:
totalTicks += p->ticks;
}
double tick_us = 1.0 / x86capabilities::CachedMHz();
double tick_us = 1.0 / GetTickFrequency();
double tick_ms = tick_us / 1000;
double tick_ns = tick_us * 1000;

View File

@ -21,6 +21,7 @@
#include "GS/GSExtra.h"
#include "PerformanceMetrics.h"
#include "common/AlignedMalloc.h"
#include "common/General.h"
#include "common/StringUtil.h"
#include "VMManager.h"
@ -144,7 +145,7 @@ void GSRasterizer::Draw(GSRasterizerData& data)
m_primcount = 0;
if constexpr (ENABLE_DRAW_STATS)
data.start = __rdtsc();
data.start = GetCPUTicks();
m_setup_prim = data.setup_prim;
m_draw_scanline = data.draw_scanline;
@ -257,7 +258,7 @@ void GSRasterizer::Draw(GSRasterizerData& data)
m_pixels.sum += m_pixels.actual;
if constexpr (ENABLE_DRAW_STATS)
m_ds->UpdateDrawStats(data.frame, __rdtsc() - data.start, m_pixels.actual, m_pixels.total, m_primcount);
m_ds->UpdateDrawStats(data.frame, GetCPUTicks() - data.start, m_pixels.actual, m_pixels.total, m_primcount);
}
template <bool scissor_test>
@ -1192,7 +1193,9 @@ int GSSingleRasterizer::GetPixels(bool reset /*= true*/)
void GSSingleRasterizer::PrintStats()
{
#ifdef ENABLE_DRAW_STATS
m_ds.PrintStats();
#endif
}
//

View File

@ -580,7 +580,7 @@ void GSRendererSW::Sync(int reason)
{
//printf("sync %d\n", reason);
u64 t = LOG ? __rdtsc() : 0;
u64 t = LOG ? GetCPUTicks() : 0;
m_rl->Sync();
@ -603,7 +603,7 @@ void GSRendererSW::Sync(int reason)
}
}
t = LOG ? (__rdtsc() - t) : 0;
t = LOG ? (GetCPUTicks() - t) : 0;
int pixels = m_rl->GetPixels();
@ -1457,7 +1457,7 @@ GSRendererSW::SharedData::~SharedData()
{
fprintf(s_fp, "[%d] done t=%lld p=%d | %d %d %d | %08x_%08x\n",
counter,
__rdtsc() - start, pixels,
GetCPUTicks() - start, pixels,
primclass, vertex_count, index_count,
global.sel.hi, global.sel.lo);
fflush(s_fp);