dolphin/Source/Core/VideoCommon/PerformanceMetrics.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.4 KiB
C
Raw Normal View History

2022-12-24 01:52:53 +01:00
// Copyright 2022 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <array>
#include <shared_mutex>
#include "Common/CommonTypes.h"
2022-12-24 01:52:53 +01:00
#include "VideoCommon/PerformanceTracker.h"
namespace Core
{
class System;
}
2022-12-24 01:52:53 +01:00
class PerformanceMetrics
{
public:
PerformanceMetrics() = default;
~PerformanceMetrics() = default;
PerformanceMetrics(const PerformanceMetrics&) = delete;
PerformanceMetrics& operator=(const PerformanceMetrics&) = delete;
PerformanceMetrics(PerformanceMetrics&&) = delete;
PerformanceMetrics& operator=(PerformanceMetrics&&) = delete;
2022-12-24 02:13:01 +01:00
// Count Functions
2022-12-24 01:52:53 +01:00
void Reset();
void CountFrame();
void CountVBlank();
void CountThrottleSleep(DT sleep);
void CountPerformanceMarker(Core::System& system, s64 cyclesLate);
2022-12-24 02:13:01 +01:00
// Getter Functions
2022-12-24 01:52:53 +01:00
double GetFPS() const;
double GetVPS() const;
double GetSpeed() const;
double GetMaxSpeed() const;
2022-12-24 01:52:53 +01:00
double GetLastSpeedDenominator() const;
2022-12-24 02:13:01 +01:00
// ImGui Functions
void DrawImGuiStats(const float backbuffer_scale);
2022-12-24 01:52:53 +01:00
2022-12-24 02:13:01 +01:00
private:
2022-12-24 01:52:53 +01:00
PerformanceTracker m_fps_counter{"render_times.txt"};
PerformanceTracker m_vps_counter{"vblank_times.txt"};
2023-01-29 19:33:48 +01:00
PerformanceTracker m_speed_counter{std::nullopt, 1000000};
double m_graph_max_time = 0.0;
mutable std::shared_mutex m_time_lock;
u8 m_time_index = 0;
std::array<TimePoint, 256> m_real_times{};
std::array<TimePoint, 256> m_cpu_times{};
DT m_time_sleeping{};
2022-12-24 01:52:53 +01:00
};
extern PerformanceMetrics g_perf_metrics;