From a858032e460204cf4d9b62892cedb4873625b940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 12 Dec 2024 17:57:43 +0100 Subject: [PATCH] Remove obsolete accounting for time spent stepping the GE (we no longer block) --- Core/HLE/HLE.cpp | 10 ++-------- Core/HLE/HLE.h | 2 -- GPU/Common/GPUDebugInterface.h | 4 ---- GPU/Debugger/Stepping.cpp | 7 +++++-- GPU/GPUCommon.cpp | 29 +++++------------------------ GPU/GPUCommon.h | 7 ------- 6 files changed, 12 insertions(+), 47 deletions(-) diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index 2e0a3710a3..a6809cc592 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -758,16 +758,11 @@ void *GetQuickSyscallFunc(MIPSOpcode op) { return (void *)&CallSyscallWithoutFlags; } -void hleSetSteppingTime(double t) { - hleSteppingTime += t; -} - void hleSetFlipTime(double t) { hleFlipTime = t; } -void CallSyscall(MIPSOpcode op) -{ +void CallSyscall(MIPSOpcode op) { PROFILE_THIS_SCOPE("syscall"); double start = 0.0; // need to initialize to fix the race condition where coreCollectDebugStats is enabled in the middle of this func. if (coreCollectDebugStats) { @@ -797,11 +792,10 @@ void CallSyscall(MIPSOpcode op) u32 callno = (op >> 6) & 0xFFFFF; //20 bits int funcnum = callno & 0xFFF; int modulenum = (callno & 0xFF000) >> 12; - double total = time_now_d() - start - hleSteppingTime; + double total = time_now_d() - start; if (total >= hleFlipTime) total -= hleFlipTime; _dbg_assert_msg_(total >= 0.0, "Time spent in syscall became negative"); - hleSteppingTime = 0.0; hleFlipTime = 0.0; updateSyscallStats(modulenum, funcnum, total); } diff --git a/Core/HLE/HLE.h b/Core/HLE/HLE.h index eff5fba1c9..b4cf7f6874 100644 --- a/Core/HLE/HLE.h +++ b/Core/HLE/HLE.h @@ -114,8 +114,6 @@ void hleRunInterrupts(); void hleDebugBreak(); // Don't set temp regs to 0xDEADBEEF. void hleSkipDeadbeef(); -// Set time spent in debugger (for more useful debug stats while debugging.) -void hleSetSteppingTime(double t); // Set time spent in realtime sync. void hleSetFlipTime(double t); // Check if the current syscall context is kernel. diff --git a/GPU/Common/GPUDebugInterface.h b/GPU/Common/GPUDebugInterface.h index b68288b0ee..35e607db75 100644 --- a/GPU/Common/GPUDebugInterface.h +++ b/GPU/Common/GPUDebugInterface.h @@ -213,10 +213,6 @@ public: virtual GPUDebugOp DisassembleOp(u32 pc, u32 op) = 0; virtual std::vector DisassembleOpRange(u32 startpc, u32 endpc) = 0; - // Enter/exit stepping mode. Mainly for better debug stats on time taken. - virtual void NotifySteppingEnter() = 0; - virtual void NotifySteppingExit() = 0; - virtual u32 GetRelativeAddress(u32 data) = 0; virtual u32 GetVertexAddress() = 0; virtual u32 GetIndexAddress() = 0; diff --git a/GPU/Debugger/Stepping.cpp b/GPU/Debugger/Stepping.cpp index 122cde8714..b4a0a81d10 100644 --- a/GPU/Debugger/Stepping.cpp +++ b/GPU/Debugger/Stepping.cpp @@ -21,6 +21,7 @@ #include "Common/Log.h" #include "Common/Thread/ThreadUtil.h" #include "Core/Core.h" +#include "Core/HW/Display.h" #include "GPU/Common/GPUDebugInterface.h" #include "GPU/Debugger/Stepping.h" #include "GPU/GPUState.h" @@ -44,6 +45,10 @@ static bool isStepping; // Number of times we've entered stepping, to detect a resume asynchronously. static int stepCounter = 0; +// Debug stats. +static double g_timeSteppingStarted; +static double g_timeSpentStepping; + static std::mutex pauseLock; static PauseAction pauseAction = PAUSE_CONTINUE; static std::mutex actionLock; @@ -162,13 +167,11 @@ static void StartStepping() { // Play it safe so we don't keep resetting. lastGState.cmdmem[1] |= 0x01000000; } - gpuDebug->NotifySteppingEnter(); isStepping = true; stepCounter++; } static void StopStepping() { - gpuDebug->NotifySteppingExit(); lastGState = gstate; isStepping = false; } diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 4c296feb71..c9ff5defe3 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -44,6 +44,7 @@ #include "GPU/Common/TextureCacheCommon.h" #include "GPU/Debugger/Debugger.h" #include "GPU/Debugger/Record.h" +#include "GPU/Debugger/Stepping.h" void GPUCommon::Flush() { drawEngineCommon_->DispatchFlush(); @@ -105,7 +106,6 @@ void GPUCommon::Reinitialize() { isbreak = false; drawCompleteTicks = 0; busyTicks = 0; - timeSpentStepping_ = 0.0; interruptsEnabled_ = true; if (textureCache_) @@ -615,23 +615,6 @@ u32 GPUCommon::Break(int mode) { return currentList->id; } -void GPUCommon::NotifySteppingEnter() { - if (coreCollectDebugStats) { - timeSteppingStarted_ = time_now_d(); - } -} -void GPUCommon::NotifySteppingExit() { - if (coreCollectDebugStats) { - if (timeSteppingStarted_ <= 0.0) { - ERROR_LOG(Log::G3D, "Mismatched stepping enter/exit."); - } - double total = time_now_d() - timeSteppingStarted_; - _dbg_assert_msg_(total >= 0.0, "Time spent stepping became negative"); - timeSpentStepping_ += total; - timeSteppingStarted_ = 0.0; - } -} - bool GPUCommon::InterpretList(DisplayList &list) { // Initialized to avoid a race condition with bShowDebugStats changing. double start = 0.0; @@ -683,6 +666,9 @@ bool GPUCommon::InterpretList(DisplayList &list) { FinishDeferred(); _dbg_assert_(!GPURecord::IsActive()); gpuState = GPUSTATE_BREAK; + if (coreCollectDebugStats) { + gpuStats.msProcessingDisplayLists += time_now_d() - start; + } return false; } } @@ -706,12 +692,7 @@ bool GPUCommon::InterpretList(DisplayList &list) { list.offsetAddr = gstate_c.offsetAddr; if (coreCollectDebugStats) { - double total = time_now_d() - start - timeSpentStepping_; - _dbg_assert_msg_(total >= 0.0, "Time spent DL processing became negative"); - hleSetSteppingTime(timeSpentStepping_); - DisplayNotifySleep(timeSpentStepping_); - timeSpentStepping_ = 0.0; - gpuStats.msProcessingDisplayLists += total; + gpuStats.msProcessingDisplayLists += time_now_d() - start; } return gpuState == GPUSTATE_DONE || gpuState == GPUSTATE_ERROR; } diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 89465eca70..ec7bb50deb 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -349,9 +349,6 @@ public: GPUDebugOp DisassembleOp(u32 pc, u32 op) override; std::vector DisassembleOpRange(u32 startpc, u32 endpc) override; - void NotifySteppingEnter() override; - void NotifySteppingExit() override; - u32 GetRelativeAddress(u32 data) override; u32 GetVertexAddress() override; u32 GetIndexAddress() override; @@ -510,8 +507,4 @@ private: void PopDLQueue(); void CheckDrawSync(); int GetNextListIndex(); - - // Debug stats. - double timeSteppingStarted_; - double timeSpentStepping_; };