diff --git a/Core/MIPS/IR/IRJit.cpp b/Core/MIPS/IR/IRJit.cpp index 93264f4881..aba70c8e79 100644 --- a/Core/MIPS/IR/IRJit.cpp +++ b/Core/MIPS/IR/IRJit.cpp @@ -169,6 +169,8 @@ void IRJit::InvalidateCacheAt(u32 em_address, int length) { } DEBUG_LOG(Log::JIT, "Invalidating IR block cache at %08x (%d bytes): %d blocks", em_address, length, (int)numbers.size()); + invalidations_++; + invalidatedBlocks_ += (int)numbers.size(); for (int block_num : numbers) { auto block = blocks_.GetBlock(block_num); @@ -251,6 +253,8 @@ void IRJit::GetStats(JitStats *stats) const { stats->irArenaSize = IRBlockCache::MAX_ARENA_SIZE; stats->irArenaFullClears = irArenaFullClears_; stats->codeFullClears = codeFullClears_; + stats->invalidations = invalidations_; + stats->invalidatedBlocks = invalidatedBlocks_; } void IRJit::RunLoopUntil(u64 globalticks) { diff --git a/Core/MIPS/IR/IRJit.h b/Core/MIPS/IR/IRJit.h index e828ec30f5..2b20813c6b 100644 --- a/Core/MIPS/IR/IRJit.h +++ b/Core/MIPS/IR/IRJit.h @@ -253,6 +253,8 @@ protected: int irArenaFullClears_ = 0; int codeFullClears_ = 0; + int invalidations_ = 0; + int invalidatedBlocks_ = 0; // where to write branch-likely trampolines. not used atm // u32 blTrampolines_; diff --git a/Core/MIPS/JitCommon/JitCommon.h b/Core/MIPS/JitCommon/JitCommon.h index 5f51de8b4a..6077991a3c 100644 --- a/Core/MIPS/JitCommon/JitCommon.h +++ b/Core/MIPS/JitCommon/JitCommon.h @@ -127,6 +127,9 @@ namespace MIPSComp { // How many times the cache was cleared because one of them filled up. int irArenaFullClears = 0; int codeFullClears = 0; + // Calls to InvalidateCacheAt that hit at least one block, and the blocks they hit. + int invalidations = 0; + int invalidatedBlocks = 0; }; class JitInterface { diff --git a/UI/DebugOverlay.cpp b/UI/DebugOverlay.cpp index 4ad819e980..1edb26f277 100644 --- a/UI/DebugOverlay.cpp +++ b/UI/DebugOverlay.cpp @@ -87,6 +87,7 @@ static void DrawJitStats(UIContext *ctx, const Bounds &bounds) { w.F("IR arena: %d / %d instructions (%0.1f%%)\n", (int)stats.irArenaUsed, (int)stats.irArenaSize, irPercent); w.F("Cleared because full: %d\n", stats.irArenaFullClears); } + w.F("Invalidations: %d (%d blocks)\n", stats.invalidations, stats.invalidatedBlocks); } else { w.W("No JIT (interpreter)\n"); }