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