early-access version 1690

This commit is contained in:
pineappleEA
2021-05-16 21:32:58 +02:00
parent 57e7aafeca
commit 23d1664dc2
15 changed files with 59 additions and 19 deletions

View File

@@ -76,9 +76,7 @@ void PerfStats::EndSystemFrame() {
}
void PerfStats::EndGameFrame() {
std::lock_guard lock{object_mutex};
game_frames += 1;
game_frames.fetch_add(1, std::memory_order_relaxed);
}
double PerfStats::GetMeanFrametime() const {
@@ -101,10 +99,11 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us
const auto interval = duration_cast<DoubleSecs>(now - reset_point).count();
const auto system_us_per_second = (current_system_time_us - reset_point_system_us) / interval;
const auto current_frames = static_cast<double>(game_frames.load(std::memory_order_relaxed));
const auto current_fps = current_frames / interval;
const PerfStatsResults results{
.system_fps = static_cast<double>(system_frames) / interval,
.game_fps = static_cast<double>(game_frames) / interval,
.average_game_fps = (current_fps + previous_fps) / 2.0,
.frametime = duration_cast<DoubleSecs>(accumulated_frametime).count() /
static_cast<double>(system_frames),
.emulation_speed = system_us_per_second.count() / 1'000'000.0,
@@ -115,7 +114,8 @@ PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us
reset_point_system_us = current_system_time_us;
accumulated_frametime = Clock::duration::zero();
system_frames = 0;
game_frames = 0;
game_frames.store(0, std::memory_order_relaxed);
previous_fps = current_fps;
return results;
}