Debugger: Refresh at 100hz during debugger interaction (was 20hz)

This commit is contained in:
Eladash 2022-06-22 08:57:16 +03:00 committed by Megamouse
parent 661b485b58
commit 794cbd8708
2 changed files with 36 additions and 4 deletions

View File

@ -743,8 +743,17 @@ std::function<cpu_thread*()> 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<cpu_thread*, u32>;
@ -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)

View File

@ -58,6 +58,8 @@ class debugger_frame : public custom_dock_widget
u32 m_last_pc = -1;
std::vector<char> 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<CPUDisAsm> m_disasm; // Only shared to allow base/derived functionality
std::shared_ptr<cpu_thread> m_cpu;