From 794cbd8708c56ec1b5224fca01178f2d27c41289 Mon Sep 17 00:00:00 2001 From: Eladash Date: Wed, 22 Jun 2022 08:57:16 +0300 Subject: [PATCH] Debugger: Refresh at 100hz during debugger interaction (was 20hz) --- rpcs3/rpcs3qt/debugger_frame.cpp | 38 ++++++++++++++++++++++++++++---- rpcs3/rpcs3qt/debugger_frame.h | 2 ++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index bd90bd778e..14c5741356 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -743,8 +743,17 @@ std::function debugger_frame::make_check_cpu(cpu_thread* cpu) void debugger_frame::UpdateUI() { - UpdateUnitList(); - ShowPC(); + if (m_ui_update_ctr % 5 == 0) + { + // If no change to instruction position happened, update instruction list at 20hz + ShowPC(); + + if (m_ui_update_ctr % 20 == 0) + { + // Update threads list at 5hz (low priority) + UpdateUnitList(); + } + } const auto cpu = get_cpu(); @@ -752,12 +761,14 @@ void debugger_frame::UpdateUI() { if (m_last_pc != umax || !m_last_query_state.empty()) { + UpdateUnitList(); + ShowPC(); m_last_query_state.clear(); m_last_pc = -1; DoUpdate(); } } - else + else if (m_ui_update_ctr % 5 == 0 || m_ui_update_ctr < m_ui_fast_update_permission_deadline) { const auto cia = cpu->get_pc(); const auto size_context = cpu->id_type() == 1 ? sizeof(ppu_thread) : @@ -783,13 +794,31 @@ void debugger_frame::UpdateUI() m_btn_run->setText(PauseString); } + if (m_ui_update_ctr % 5) + { + // Call if it hasn't been called before + ShowPC(); + } + if (is_using_interpreter(cpu->id_type())) { m_btn_step->setEnabled(paused); m_btn_step_over->setEnabled(paused); } + + // Relax, an update has occured. There's little sense in keeping this stressful watch for thread info changes + // This allows slow updating to thread state if its running so we can observe changes in thread info more carefully while also not hurting performance + m_ui_fast_update_permission_deadline = 0; + } + else if (m_ui_update_ctr >= m_ui_fast_update_permission_deadline && is_using_interpreter(cpu->id_type())) + { + // Tighten up, put the debugger on a wary watch over any thread info changes if there aren't any + // This allows responsive debugger insteraction + m_ui_fast_update_permission_deadline = (m_ui_update_ctr / 5 + 1) * 5; } } + + m_ui_update_ctr++; } using data_type = std::pair; @@ -979,6 +1008,7 @@ void debugger_frame::WritePanels() { m_misc_state->clear(); m_regs->clear(); + ClearCallStack(); return; } @@ -1156,7 +1186,7 @@ void debugger_frame::DoStep(bool step_over) void debugger_frame::EnableUpdateTimer(bool enable) const { - enable ? m_update->start(50) : m_update->stop(); + enable ? m_update->start(10) : m_update->stop(); } void debugger_frame::EnableButtons(bool enable) diff --git a/rpcs3/rpcs3qt/debugger_frame.h b/rpcs3/rpcs3qt/debugger_frame.h index 1604a420c1..83f6033925 100644 --- a/rpcs3/rpcs3qt/debugger_frame.h +++ b/rpcs3/rpcs3qt/debugger_frame.h @@ -58,6 +58,8 @@ class debugger_frame : public custom_dock_widget u32 m_last_pc = -1; std::vector m_last_query_state; u32 m_last_step_over_breakpoint = -1; + u64 m_ui_update_ctr = 0; + u64 m_ui_fast_update_permission_deadline = 0; std::shared_ptr m_disasm; // Only shared to allow base/derived functionality std::shared_ptr m_cpu;