aboutsummaryrefslogtreecommitdiff
path: root/src/core/perf_stats.cpp
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-07-22 19:56:21 -0400
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 22:10:01 -0400
commit9dfbc9bdce15c299faf06aa7bf68a8660366daee (patch)
tree83ae648f51b4d0d2bb484741f86f5fb9bce8d00b /src/core/perf_stats.cpp
parentdb46f8a70c853ccab3318abed1416231a3c426db (diff)
general: Rename "Frame Limit" references to "Speed Limit"
This setting is best referred to as a speed limit, as it involves the limits of all timing based aspects of the emulator, not only framerate. This allows us to differentiate it from the fps unlocker setting.
Diffstat (limited to 'src/core/perf_stats.cpp')
-rw-r--r--src/core/perf_stats.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp
index 6635a13393..c9ded49d00 100644
--- a/src/core/perf_stats.cpp
+++ b/src/core/perf_stats.cpp
@@ -127,15 +127,15 @@ double PerfStats::GetLastFrameTimeScale() const {
return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH;
}
-void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) {
- if (!Settings::values.use_frame_limit.GetValue() ||
+void SpeedLimiter::DoSpeedLimiting(microseconds current_system_time_us) {
+ if (!Settings::values.use_speed_limit.GetValue() ||
Settings::values.use_multi_core.GetValue()) {
return;
}
auto now = Clock::now();
- const double sleep_scale = Settings::values.frame_limit.GetValue() / 100.0;
+ const double sleep_scale = Settings::values.speed_limit.GetValue() / 100.0;
// Max lag caused by slow frames. Shouldn't be more than the length of a frame at the current
// speed percent or it will clamp too much and prevent this from properly limiting to that
@@ -143,17 +143,17 @@ void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) {
// limiting
const microseconds max_lag_time_us = duration_cast<microseconds>(
std::chrono::duration<double, std::chrono::microseconds::period>(25ms / sleep_scale));
- frame_limiting_delta_err += duration_cast<microseconds>(
+ speed_limiting_delta_err += duration_cast<microseconds>(
std::chrono::duration<double, std::chrono::microseconds::period>(
(current_system_time_us - previous_system_time_us) / sleep_scale));
- frame_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime);
- frame_limiting_delta_err =
- std::clamp(frame_limiting_delta_err, -max_lag_time_us, max_lag_time_us);
+ speed_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime);
+ speed_limiting_delta_err =
+ std::clamp(speed_limiting_delta_err, -max_lag_time_us, max_lag_time_us);
- if (frame_limiting_delta_err > microseconds::zero()) {
- std::this_thread::sleep_for(frame_limiting_delta_err);
+ if (speed_limiting_delta_err > microseconds::zero()) {
+ std::this_thread::sleep_for(speed_limiting_delta_err);
auto now_after_sleep = Clock::now();
- frame_limiting_delta_err -= duration_cast<microseconds>(now_after_sleep - now);
+ speed_limiting_delta_err -= duration_cast<microseconds>(now_after_sleep - now);
now = now_after_sleep;
}