blob: d1f4211a468c51d30e44786014f9905e8d482da1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// Copyright 2022 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <array>
#include <shared_mutex>
#include "Common/CommonTypes.h"
#include "VideoCommon/PerformanceTracker.h"
namespace Core
{
class System;
}
class PerformanceMetrics
{
public:
PerformanceMetrics() = default;
~PerformanceMetrics() = default;
PerformanceMetrics(const PerformanceMetrics&) = delete;
PerformanceMetrics& operator=(const PerformanceMetrics&) = delete;
PerformanceMetrics(PerformanceMetrics&&) = delete;
PerformanceMetrics& operator=(PerformanceMetrics&&) = delete;
// Count Functions
void Reset();
void CountFrame();
void CountVBlank();
void CountThrottleSleep(DT sleep);
void CountPerformanceMarker(Core::System& system, s64 cyclesLate);
// Getter Functions
double GetFPS() const;
double GetVPS() const;
double GetSpeed() const;
double GetMaxSpeed() const;
double GetLastSpeedDenominator() const;
// ImGui Functions
void DrawImGuiStats(const float backbuffer_scale);
private:
PerformanceTracker m_fps_counter{"render_times.txt"};
PerformanceTracker m_vps_counter{"vblank_times.txt"};
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{};
};
extern PerformanceMetrics g_perf_metrics;
|