mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-14 15:51:29 +02:00
PerformanceTracker: Pass chrono values instead of us s64.
This commit is contained in:
parent
225039f742
commit
b2ce3fbefc
@ -47,7 +47,7 @@ public:
|
||||
private:
|
||||
PerformanceTracker m_fps_counter{"render_times.txt"};
|
||||
PerformanceTracker m_vps_counter{"vblank_times.txt"};
|
||||
PerformanceTracker m_speed_counter{std::nullopt, 1000000};
|
||||
PerformanceTracker m_speed_counter{std::nullopt, std::chrono::seconds{1}};
|
||||
|
||||
double m_graph_max_time = 0.0;
|
||||
|
||||
|
@ -12,21 +12,20 @@
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Timer.h"
|
||||
#include "Core/Core.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
static constexpr double SAMPLE_RC_RATIO = 0.25;
|
||||
|
||||
PerformanceTracker::PerformanceTracker(const std::optional<std::string> log_name,
|
||||
const std::optional<s64> sample_window_us)
|
||||
const std::optional<DT> sample_window_duration)
|
||||
: m_on_state_changed_handle{Core::AddOnStateChangedCallback([this](Core::State state) {
|
||||
if (state == Core::State::Paused)
|
||||
SetPaused(true);
|
||||
else if (state == Core::State::Running)
|
||||
SetPaused(false);
|
||||
})},
|
||||
m_log_name{log_name}, m_sample_window_us{sample_window_us}
|
||||
m_log_name{log_name}, m_sample_window_duration{sample_window_duration}
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
@ -92,8 +91,8 @@ void PerformanceTracker::Count()
|
||||
DT PerformanceTracker::GetSampleWindow() const
|
||||
{
|
||||
// This reads a constant value and thus does not need a mutex
|
||||
return std::chrono::duration_cast<DT>(
|
||||
DT_us(m_sample_window_us.value_or(std::max(1, g_ActiveConfig.iPerfSampleUSec))));
|
||||
return m_sample_window_duration.value_or(
|
||||
duration_cast<DT>(DT_us{std::max(1, g_ActiveConfig.iPerfSampleUSec)}));
|
||||
}
|
||||
|
||||
double PerformanceTracker::GetHzAvg() const
|
||||
|
@ -4,7 +4,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <shared_mutex>
|
||||
@ -35,7 +34,7 @@ private:
|
||||
|
||||
public:
|
||||
PerformanceTracker(const std::optional<std::string> log_name = std::nullopt,
|
||||
const std::optional<s64> sample_window_us = std::nullopt);
|
||||
const std::optional<DT> sample_window_duration = std::nullopt);
|
||||
~PerformanceTracker();
|
||||
|
||||
PerformanceTracker(const PerformanceTracker&) = delete;
|
||||
@ -84,7 +83,7 @@ private: // Functions for managing dt queue
|
||||
TimePoint m_last_time;
|
||||
|
||||
// Amount of time to sample dt's over (defaults to config)
|
||||
const std::optional<s64> m_sample_window_us;
|
||||
const std::optional<DT> m_sample_window_duration;
|
||||
|
||||
// Queue + Running Total used to calculate average dt
|
||||
DT m_dt_total = DT::zero();
|
||||
|
Loading…
x
Reference in New Issue
Block a user