summaryrefslogtreecommitdiff
path: root/src/core/perf_stats.h
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2017-02-20 16:31:59 -0800
committerGravatar Yuri Kunde Schlesner2017-02-26 17:22:04 -0800
commitfb1979d7e26c20fe2b8d2c3d3dc998e5e00f2f61 (patch)
tree690461954bff040727fa2cb3b34c9d71c003ea9c /src/core/perf_stats.h
parentCore: Make PerfStats internally locked (diff)
downloadyuzu-fb1979d7e26c20fe2b8d2c3d3dc998e5e00f2f61.tar.gz
yuzu-fb1979d7e26c20fe2b8d2c3d3dc998e5e00f2f61.tar.xz
yuzu-fb1979d7e26c20fe2b8d2c3d3dc998e5e00f2f61.zip
Core: Re-write frame limiter
Now based on std::chrono, and also works in terms of emulated time instead of frames, so we can in the future frame-limit even when the display is disabled, etc. The frame limiter can also be enabled along with v-sync now, which should be useful for those with displays running at more than 60 Hz.
Diffstat (limited to 'src/core/perf_stats.h')
-rw-r--r--src/core/perf_stats.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/perf_stats.h b/src/core/perf_stats.h
index 4098fc1f2..b03adab68 100644
--- a/src/core/perf_stats.h
+++ b/src/core/perf_stats.h
@@ -55,4 +55,20 @@ private:
55 u32 game_frames = 0; 55 u32 game_frames = 0;
56}; 56};
57 57
58class FrameLimiter {
59public:
60 using Clock = std::chrono::high_resolution_clock;
61
62 void DoFrameLimiting(u64 current_system_time_us);
63
64private:
65 /// Emulated system time (in microseconds) at the last limiter invocation
66 u64 previous_system_time_us = 0;
67 /// Walltime at the last limiter invocation
68 Clock::time_point previous_walltime = Clock::now();
69
70 /// Accumulated difference between walltime and emulated time
71 std::chrono::microseconds frame_limiting_delta_err{0};
72};
73
58} // namespace Core 74} // namespace Core