summaryrefslogtreecommitdiff
path: root/src/core/perf_stats.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/perf_stats.cpp')
-rw-r--r--src/core/perf_stats.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp
index 29339ead7..36372c66f 100644
--- a/src/core/perf_stats.cpp
+++ b/src/core/perf_stats.cpp
@@ -74,15 +74,16 @@ void PerfStats::EndGameFrame() {
74 game_frames += 1; 74 game_frames += 1;
75} 75}
76 76
77double PerfStats::GetMeanFrametime() { 77double PerfStats::GetMeanFrametime() const {
78 std::lock_guard lock{object_mutex}; 78 std::lock_guard lock{object_mutex};
79 79
80 if (current_index <= IgnoreFrames) { 80 if (current_index <= IgnoreFrames) {
81 return 0; 81 return 0;
82 } 82 }
83
83 const double sum = std::accumulate(perf_history.begin() + IgnoreFrames, 84 const double sum = std::accumulate(perf_history.begin() + IgnoreFrames,
84 perf_history.begin() + current_index, 0.0); 85 perf_history.begin() + current_index, 0.0);
85 return sum / (current_index - IgnoreFrames); 86 return sum / static_cast<double>(current_index - IgnoreFrames);
86} 87}
87 88
88PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us) { 89PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us) {
@@ -111,7 +112,7 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us
111 return results; 112 return results;
112} 113}
113 114
114double PerfStats::GetLastFrameTimeScale() { 115double PerfStats::GetLastFrameTimeScale() const {
115 std::lock_guard lock{object_mutex}; 116 std::lock_guard lock{object_mutex};
116 117
117 constexpr double FRAME_LENGTH = 1.0 / 60; 118 constexpr double FRAME_LENGTH = 1.0 / 60;