Add perf stat logging through ini setting
For better tracking of performance regressions on incoming changes, this change adds a way to dump frametime to file by changing an ini config option. This is intentionally hidden as its only useful to a small number of individuals, and not really applicable to the general userbase.
This commit is contained in:
parent
84b40f2da6
commit
62e6c147ae
11 changed files with 78 additions and 11 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
|
@ -18,6 +19,10 @@ namespace Core {
|
|||
*/
|
||||
class PerfStats {
|
||||
public:
|
||||
explicit PerfStats(u64 title_id);
|
||||
|
||||
~PerfStats();
|
||||
|
||||
using Clock = std::chrono::high_resolution_clock;
|
||||
|
||||
struct Results {
|
||||
|
@ -37,6 +42,11 @@ public:
|
|||
|
||||
Results GetAndResetStats(std::chrono::microseconds current_system_time_us);
|
||||
|
||||
/**
|
||||
* Returns the Arthimetic Mean of all frametime values stored in the performance history.
|
||||
*/
|
||||
double GetMeanFrametime();
|
||||
|
||||
/**
|
||||
* Gets the ratio between walltime and the emulated time of the previous system frame. This is
|
||||
* useful for scaling inputs or outputs moving between the two time domains.
|
||||
|
@ -44,7 +54,15 @@ public:
|
|||
double GetLastFrameTimeScale();
|
||||
|
||||
private:
|
||||
std::mutex object_mutex;
|
||||
std::mutex object_mutex{};
|
||||
|
||||
/// Title ID for the game that is running. 0 if there is no game running yet
|
||||
u64 title_id{0};
|
||||
/// Current index for writing to the perf_history array
|
||||
size_t current_index{0};
|
||||
/// Stores an hour of historical frametime data useful for processing and tracking performance
|
||||
/// regressions with code changes.
|
||||
std::array<double, 216000> perf_history = {};
|
||||
|
||||
/// Point when the cumulative counters were reset
|
||||
Clock::time_point reset_point = Clock::now();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue