mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
There were no texture-cache hit/miss counters at all. Hit/miss was visible only as GL_CACHE strings, which are compiled out unless ENABLE_OGL_DEBUG is set and are further gated on UseDebugDevice at emit time -- so on a shipped build the texture cache is completely opaque. For a tiler-bound title, source misses (upload + swizzle) are a prime suspect we could not see. Adds TCSourceHit/Miss, TCTargetHit/Miss and HashCacheHit/Miss, incremented at the existing hit/miss forks in LookupSource and the hash cache lookup. The new entries are appended after the ROV counters so the aliased slots (TextureCopies = Fillrate, TextureUploads = SyncPoint) keep their indices. Also fills in the three missing HW counter names. names_hw was declared [CounterLastHW] but had only 10 initialisers, leaving TextureCopiesROV, DrawCallsROV and BarriersROV as null pointers -- GSPerfMon::Dump iterates to CounterLastHW and passed them straight to fprintf %s.
85 lines
1.7 KiB
C++
85 lines
1.7 KiB
C++
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
|
// SPDX-License-Identifier: GPL-3.0+
|
|
|
|
#pragma once
|
|
|
|
#include "common/Pcsx2Defs.h"
|
|
|
|
#include <ctime>
|
|
#include <string>
|
|
|
|
class GSPerfMon
|
|
{
|
|
public:
|
|
enum counter_t
|
|
{
|
|
Prim,
|
|
Draw,
|
|
DrawCalls,
|
|
Readbacks,
|
|
Swizzle,
|
|
Unswizzle,
|
|
Fillrate,
|
|
SyncPoint,
|
|
Barriers,
|
|
RenderPasses,
|
|
TextureCopiesROV, // Overlaps with regular texture copies.
|
|
DrawCallsROV, // Overlaps with regular draw calls.
|
|
BarriersROV, // Overlaps with regular barriers.
|
|
|
|
// Texture cache lookup outcomes (HW only). Appended last so the aliased
|
|
// slots below keep their existing indices.
|
|
TCTargetHit,
|
|
TCTargetMiss,
|
|
TCSourceHit,
|
|
TCSourceMiss,
|
|
HashCacheHit,
|
|
HashCacheMiss,
|
|
|
|
CounterLast,
|
|
|
|
// Reused counters for HW.
|
|
TextureCopies = Fillrate,
|
|
TextureUploads = SyncPoint,
|
|
|
|
CounterLastHW = CounterLast,
|
|
CounterLastSW = SyncPoint + 1
|
|
};
|
|
|
|
protected:
|
|
double m_counters[CounterLast] = {};
|
|
double m_stats[CounterLast] = {};
|
|
int m_frame = 0;
|
|
clock_t m_lastframe = 0;
|
|
int m_count = 0;
|
|
int m_disp_fb_sprite_blits = 0;
|
|
|
|
public:
|
|
GSPerfMon();
|
|
|
|
void Reset();
|
|
|
|
void SetFrame(int frame) { m_frame = frame; }
|
|
int GetFrame() { return m_frame; }
|
|
void EndFrame(bool frame_only);
|
|
|
|
void Put(counter_t c, double val) { m_counters[c] += val; }
|
|
double GetCounter(counter_t c) { return m_counters[c]; }
|
|
double Get(counter_t c) { return m_stats[c]; }
|
|
void Update();
|
|
|
|
__fi void AddDisplayFramebufferSpriteBlit() { m_disp_fb_sprite_blits++; }
|
|
__fi int GetDisplayFramebufferSpriteBlits()
|
|
{
|
|
const int blits = m_disp_fb_sprite_blits;
|
|
m_disp_fb_sprite_blits = 0;
|
|
return blits;
|
|
}
|
|
|
|
GSPerfMon operator-(const GSPerfMon& other);
|
|
|
|
void Dump(const std::string& filename, bool hw);
|
|
};
|
|
|
|
extern GSPerfMon g_perfmon;
|