From c75ae6c585f651a1b7c162c2e1ecccd22a1c587d Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sun, 19 Feb 2017 14:34:47 -0800 Subject: Add performance statistics to status bar --- src/core/core.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/core/core.cpp') diff --git a/src/core/core.cpp b/src/core/core.cpp index c9c9b7615..ca2c28ce4 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -109,6 +109,11 @@ void System::PrepareReschedule() { reschedule_pending = true; } +PerfStats::Results System::GetAndResetPerfStats() { + auto perf_stats = this->perf_stats.Lock(); + return perf_stats->GetAndResetStats(CoreTiming::GetGlobalTimeUs()); +} + void System::Reschedule() { if (!reschedule_pending) { return; @@ -140,6 +145,10 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { LOG_DEBUG(Core, "Initialized OK"); + // Reset counters and set time origin to current frame + GetAndResetPerfStats(); + perf_stats.Lock()->BeginSystemFrame(); + return ResultStatus::Success; } -- cgit v1.2.3 From b285c2a4ed29a126b5bcfe46e2784bd1870bdf82 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Mon, 20 Feb 2017 13:56:58 -0800 Subject: Core: Make PerfStats internally locked More ergonomic to use and will be required for upcoming changes. --- src/core/core.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/core/core.cpp') diff --git a/src/core/core.cpp b/src/core/core.cpp index ca2c28ce4..140ff6451 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -110,8 +110,7 @@ void System::PrepareReschedule() { } PerfStats::Results System::GetAndResetPerfStats() { - auto perf_stats = this->perf_stats.Lock(); - return perf_stats->GetAndResetStats(CoreTiming::GetGlobalTimeUs()); + return perf_stats.GetAndResetStats(CoreTiming::GetGlobalTimeUs()); } void System::Reschedule() { @@ -147,7 +146,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { // Reset counters and set time origin to current frame GetAndResetPerfStats(); - perf_stats.Lock()->BeginSystemFrame(); + perf_stats.BeginSystemFrame(); return ResultStatus::Success; } -- cgit v1.2.3