Fixup! Prevent issue deleting PerfStats

This commit is contained in:
James Rowe 2019-08-16 21:33:16 -06:00
parent 6f0b009497
commit 0cffab04b5
3 changed files with 7 additions and 7 deletions

View file

@ -155,6 +155,10 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st
status = ResultStatus::Success; status = ResultStatus::Success;
m_emu_window = &emu_window; m_emu_window = &emu_window;
m_filepath = filepath; m_filepath = filepath;
// Reset counters and set time origin to current frame
GetAndResetPerfStats();
perf_stats->BeginSystemFrame();
return status; return status;
} }
@ -235,10 +239,6 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mo
LOG_DEBUG(Core, "Initialized OK"); LOG_DEBUG(Core, "Initialized OK");
// Reset counters and set time origin to current frame
GetAndResetPerfStats();
perf_stats->BeginSystemFrame();
return ResultStatus::Success; return ResultStatus::Success;
} }
@ -315,6 +315,8 @@ void System::Shutdown() {
perf_results.game_fps); perf_results.game_fps);
telemetry_session->AddField(Telemetry::FieldType::Performance, "Shutdown_Frametime", telemetry_session->AddField(Telemetry::FieldType::Performance, "Shutdown_Frametime",
perf_results.frametime * 1000.0); perf_results.frametime * 1000.0);
telemetry_session->AddField(Telemetry::FieldType::Performance, "Mean_Frametime_MS",
perf_stats->GetMeanFrametime());
// Shutdown emulation session // Shutdown emulation session
GDBStub::Shutdown(); GDBStub::Shutdown();

View file

@ -216,7 +216,7 @@ public:
/// Gets a const reference to the video dumper backend /// Gets a const reference to the video dumper backend
const VideoDumper::Backend& VideoDumper() const; const VideoDumper::Backend& VideoDumper() const;
std::unique_ptr<PerfStats> perf_stats = std::make_unique<PerfStats>(0); std::unique_ptr<PerfStats> perf_stats;
FrameLimiter frame_limiter; FrameLimiter frame_limiter;
void SetStatus(ResultStatus new_status, const char* details = nullptr) { void SetStatus(ResultStatus new_status, const char* details = nullptr) {

View file

@ -99,8 +99,6 @@ TelemetrySession::~TelemetrySession() {
std::chrono::system_clock::now().time_since_epoch()) std::chrono::system_clock::now().time_since_epoch())
.count()}; .count()};
AddField(Telemetry::FieldType::Session, "Shutdown_Time", shutdown_time); AddField(Telemetry::FieldType::Session, "Shutdown_Time", shutdown_time);
AddField(Telemetry::FieldType::Performance, "Mean_Frametime_MS",
Core::System::GetInstance().perf_stats->GetMeanFrametime());
#ifdef ENABLE_WEB_SERVICE #ifdef ENABLE_WEB_SERVICE
auto backend = std::make_unique<WebService::TelemetryJson>(Settings::values.web_api_url, auto backend = std::make_unique<WebService::TelemetryJson>(Settings::values.web_api_url,