diff options
author | Lioncash <mathew1800@gmail.com> | 2020-08-03 08:12:03 -0400 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-08-03 12:33:35 -0400 |
commit | d767be65bec5a834c4ed8fddc42df4720ec1a167 (patch) | |
tree | d55cba154034112fbdcd7fc921db767a3b48c753 /src/core/perf_stats.h | |
parent | 05781ce8c4dd4d4150185effac56ef9a71ae2705 (diff) |
perf_stats: Mark GetMeanFrametime() as const
The general pattern is to mark mutexes as mutable when it comes to
matters of constness, given the mutex acts as a transient member of a
data structure.
Diffstat (limited to 'src/core/perf_stats.h')
-rw-r--r-- | src/core/perf_stats.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/core/perf_stats.h b/src/core/perf_stats.h index d9a64f072d..69256b960a 100644 --- a/src/core/perf_stats.h +++ b/src/core/perf_stats.h @@ -30,7 +30,6 @@ struct PerfStatsResults { class PerfStats { public: explicit PerfStats(u64 title_id); - ~PerfStats(); using Clock = std::chrono::high_resolution_clock; @@ -42,18 +41,18 @@ public: PerfStatsResults GetAndResetStats(std::chrono::microseconds current_system_time_us); /** - * Returns the Arthimetic Mean of all frametime values stored in the performance history. + * Returns the arithmetic mean of all frametime values stored in the performance history. */ - double GetMeanFrametime(); + double GetMeanFrametime() const; /** * 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. */ - double GetLastFrameTimeScale(); + double GetLastFrameTimeScale() const; private: - std::mutex object_mutex{}; + mutable std::mutex object_mutex; /// Title ID for the game that is running. 0 if there is no game running yet u64 title_id{0}; @@ -61,7 +60,7 @@ private: std::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 = {}; + std::array<double, 216000> perf_history{}; /// Point when the cumulative counters were reset Clock::time_point reset_point = Clock::now(); |