Core: Move CountPerformanceMarker to VideoInterface to eliminate a Throttle call. PerformanceMetrics: Fixes/Cleanups.

This commit is contained in:
Jordan Woyak
2025-03-07 19:26:47 -06:00
parent 61ab662733
commit c42dab6388
6 changed files with 52 additions and 50 deletions

View File

@ -3,8 +3,8 @@
#pragma once
#include <array>
#include <atomic>
#include <deque>
#include "Common/CommonTypes.h"
#include "VideoCommon/PerformanceTracker.h"
@ -25,15 +25,17 @@ public:
PerformanceMetrics(PerformanceMetrics&&) = delete;
PerformanceMetrics& operator=(PerformanceMetrics&&) = delete;
// Count Functions
void Reset();
void CountFrame();
void CountVBlank();
// Call from CPU thread.
void CountThrottleSleep(DT sleep);
void CountPerformanceMarker(Core::System& system, s64 cyclesLate);
void AdjustClockSpeed(s64 ticks, u32 new_ppc_clock, u32 old_ppc_clock);
void CountPerformanceMarker(s64 ticks, u32 ticks_per_second);
// Getter Functions
// Getter Functions. May be called from any thread.
double GetFPS() const;
double GetVPS() const;
double GetSpeed() const;
@ -45,14 +47,20 @@ public:
private:
PerformanceTracker m_fps_counter{"render_times.txt"};
PerformanceTracker m_vps_counter{"vblank_times.txt"};
PerformanceTracker m_speed_counter{std::nullopt, std::chrono::seconds{1}};
double m_graph_max_time = 0.0;
std::atomic<double> m_speed{};
std::atomic<double> m_max_speed{};
u8 m_time_index = 0;
std::array<TimePoint, 256> m_real_times{};
std::array<u64, 256> m_core_ticks{};
struct PerfSample
{
TimePoint clock_time;
TimePoint work_time;
s64 core_ticks;
};
std::deque<PerfSample> m_samples;
DT m_time_sleeping{};
};