summaryrefslogtreecommitdiffstats
path: root/src/core/perf_stats.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-02-20 03:18:26 +0100
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-02-27 02:22:03 +0100
commit92c8bd4b1f650438274e50303a6d3f668924d071 (patch)
tree0c9e162129dabd2424ee329b51f5765a73f6a494 /src/core/perf_stats.cpp
parentAdd performance statistics to status bar (diff)
downloadyuzu-92c8bd4b1f650438274e50303a6d3f668924d071.tar
yuzu-92c8bd4b1f650438274e50303a6d3f668924d071.tar.gz
yuzu-92c8bd4b1f650438274e50303a6d3f668924d071.tar.bz2
yuzu-92c8bd4b1f650438274e50303a6d3f668924d071.tar.lz
yuzu-92c8bd4b1f650438274e50303a6d3f668924d071.tar.xz
yuzu-92c8bd4b1f650438274e50303a6d3f668924d071.tar.zst
yuzu-92c8bd4b1f650438274e50303a6d3f668924d071.zip
Diffstat (limited to 'src/core/perf_stats.cpp')
-rw-r--r--src/core/perf_stats.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp
index 6d9e603e4..8d9e521a3 100644
--- a/src/core/perf_stats.cpp
+++ b/src/core/perf_stats.cpp
@@ -6,6 +6,9 @@
#include "core/hw/gpu.h"
#include "core/perf_stats.h"
+using DoubleSecs = std::chrono::duration<double, std::chrono::seconds::period>;
+using std::chrono::duration_cast;
+
namespace Core {
void PerfStats::BeginSystemFrame() {
@@ -16,6 +19,9 @@ void PerfStats::EndSystemFrame() {
auto frame_end = Clock::now();
accumulated_frametime += frame_end - frame_begin;
system_frames += 1;
+
+ previous_frame_length = frame_end - previous_frame_end;
+ previous_frame_end = frame_end;
}
void PerfStats::EndGameFrame() {
@@ -23,9 +29,6 @@ void PerfStats::EndGameFrame() {
}
PerfStats::Results PerfStats::GetAndResetStats(u64 current_system_time_us) {
- using DoubleSecs = std::chrono::duration<double, std::chrono::seconds::period>;
- using std::chrono::duration_cast;
-
auto now = Clock::now();
// Walltime elapsed since stats were reset
auto interval = duration_cast<DoubleSecs>(now - reset_point).count();
@@ -50,4 +53,9 @@ PerfStats::Results PerfStats::GetAndResetStats(u64 current_system_time_us) {
return results;
}
+double PerfStats::GetLastFrameTimeScale() {
+ constexpr double FRAME_LENGTH = 1.0 / GPU::SCREEN_REFRESH_RATE;
+ return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH;
+}
+
} // namespace Core