From 663b2c9c5e9e58e1a97f665044983179a1b08fd2 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 22 Feb 2021 22:04:59 +0100 Subject: [PATCH] overlays: Fix frametime graph spikes The frametime_timer was restarted at the end of the update method, instead of immediately after reading its value. This means that the frametime was lower than expected when an expensive task was executed in-between. --- Utilities/CPUStats.h | 2 +- rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/CPUStats.h b/Utilities/CPUStats.h index 3190bee02e..cb34507ec6 100644 --- a/Utilities/CPUStats.h +++ b/Utilities/CPUStats.h @@ -137,7 +137,7 @@ public: DWORD const id = GetCurrentProcessId(); // then get a process list snapshot. - HANDLE const snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0); + HANDLE const snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); // initialize the process entry structure. PROCESSENTRY32 entry = {0}; diff --git a/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp b/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp index 3068408919..51cf0cdf85 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_perf_metrics.cpp @@ -385,6 +385,7 @@ namespace rsx if (m_frametime_graph_enabled) { const auto elapsed_frame = m_frametime_timer.GetElapsedTimeInMilliSec(); + m_frametime_timer.Start(); m_frametime_graph.record_datapoint(static_cast(elapsed_frame)); } @@ -549,7 +550,6 @@ namespace rsx if (m_frametime_graph_enabled) { m_frametime_graph.update(); - m_frametime_timer.Start(); } }