summaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2017-02-19 18:35:04 -0800
committerGravatar Yuri Kunde Schlesner2017-02-26 17:22:03 -0800
commit3b4e4003336c94527339a2a9ad7d52875974258f (patch)
tree18e6e1125ff486ff3f9bd2985af7830cd7838f22 /src/citra_qt/debugger
parentPerfStats: Add method to get the instantaneous time ratio (diff)
downloadyuzu-3b4e4003336c94527339a2a9ad7d52875974258f.tar.gz
yuzu-3b4e4003336c94527339a2a9ad7d52875974258f.tar.xz
yuzu-3b4e4003336c94527339a2a9ad7d52875974258f.zip
Remove built-in (non-Microprofile) profiler
Diffstat (limited to 'src/citra_qt/debugger')
-rw-r--r--src/citra_qt/debugger/profiler.cpp111
-rw-r--r--src/citra_qt/debugger/profiler.h40
-rw-r--r--src/citra_qt/debugger/profiler.ui33
3 files changed, 2 insertions, 182 deletions
diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp
index cee10403d..f060bbe08 100644
--- a/src/citra_qt/debugger/profiler.cpp
+++ b/src/citra_qt/debugger/profiler.cpp
@@ -2,6 +2,8 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <QAction>
6#include <QLayout>
5#include <QMouseEvent> 7#include <QMouseEvent>
6#include <QPainter> 8#include <QPainter>
7#include <QString> 9#include <QString>
@@ -9,121 +11,12 @@
9#include "citra_qt/util/util.h" 11#include "citra_qt/util/util.h"
10#include "common/common_types.h" 12#include "common/common_types.h"
11#include "common/microprofile.h" 13#include "common/microprofile.h"
12#include "common/profiler_reporting.h"
13 14
14// Include the implementation of the UI in this file. This isn't in microprofile.cpp because the 15// Include the implementation of the UI in this file. This isn't in microprofile.cpp because the
15// non-Qt frontends don't need it (and don't implement the UI drawing hooks either). 16// non-Qt frontends don't need it (and don't implement the UI drawing hooks either).
16#if MICROPROFILE_ENABLED 17#if MICROPROFILE_ENABLED
17#define MICROPROFILEUI_IMPL 1 18#define MICROPROFILEUI_IMPL 1
18#include "common/microprofileui.h" 19#include "common/microprofileui.h"
19#endif
20
21using namespace Common::Profiling;
22
23static QVariant GetDataForColumn(int col, const AggregatedDuration& duration) {
24 static auto duration_to_float = [](Duration dur) -> float {
25 using FloatMs = std::chrono::duration<float, std::chrono::milliseconds::period>;
26 return std::chrono::duration_cast<FloatMs>(dur).count();
27 };
28
29 switch (col) {
30 case 1:
31 return duration_to_float(duration.avg);
32 case 2:
33 return duration_to_float(duration.min);
34 case 3:
35 return duration_to_float(duration.max);
36 default:
37 return QVariant();
38 }
39}
40
41ProfilerModel::ProfilerModel(QObject* parent) : QAbstractItemModel(parent) {
42 updateProfilingInfo();
43}
44
45QVariant ProfilerModel::headerData(int section, Qt::Orientation orientation, int role) const {
46 if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
47 switch (section) {
48 case 0:
49 return tr("Category");
50 case 1:
51 return tr("Avg");
52 case 2:
53 return tr("Min");
54 case 3:
55 return tr("Max");
56 }
57 }
58
59 return QVariant();
60}
61
62QModelIndex ProfilerModel::index(int row, int column, const QModelIndex& parent) const {
63 return createIndex(row, column);
64}
65
66QModelIndex ProfilerModel::parent(const QModelIndex& child) const {
67 return QModelIndex();
68}
69
70int ProfilerModel::columnCount(const QModelIndex& parent) const {
71 return 4;
72}
73
74int ProfilerModel::rowCount(const QModelIndex& parent) const {
75 if (parent.isValid()) {
76 return 0;
77 } else {
78 return 2;
79 }
80}
81
82QVariant ProfilerModel::data(const QModelIndex& index, int role) const {
83 if (role == Qt::DisplayRole) {
84 if (index.row() == 0) {
85 if (index.column() == 0) {
86 return tr("Frame");
87 } else {
88 return GetDataForColumn(index.column(), results.frame_time);
89 }
90 } else if (index.row() == 1) {
91 if (index.column() == 0) {
92 return tr("Frame (with swapping)");
93 } else {
94 return GetDataForColumn(index.column(), results.interframe_time);
95 }
96 }
97 }
98
99 return QVariant();
100}
101
102void ProfilerModel::updateProfilingInfo() {
103 results = GetTimingResultsAggregator()->GetAggregatedResults();
104 emit dataChanged(createIndex(0, 1), createIndex(rowCount() - 1, 3));
105}
106
107ProfilerWidget::ProfilerWidget(QWidget* parent) : QDockWidget(parent) {
108 ui.setupUi(this);
109
110 model = new ProfilerModel(this);
111 ui.treeView->setModel(model);
112
113 connect(this, SIGNAL(visibilityChanged(bool)), SLOT(setProfilingInfoUpdateEnabled(bool)));
114 connect(&update_timer, SIGNAL(timeout()), model, SLOT(updateProfilingInfo()));
115}
116
117void ProfilerWidget::setProfilingInfoUpdateEnabled(bool enable) {
118 if (enable) {
119 update_timer.start(100);
120 model->updateProfilingInfo();
121 } else {
122 update_timer.stop();
123 }
124}
125
126#if MICROPROFILE_ENABLED
127 20
128class MicroProfileWidget : public QWidget { 21class MicroProfileWidget : public QWidget {
129public: 22public:
diff --git a/src/citra_qt/debugger/profiler.h b/src/citra_qt/debugger/profiler.h
index c8912fd5a..eae1e9e3c 100644
--- a/src/citra_qt/debugger/profiler.h
+++ b/src/citra_qt/debugger/profiler.h
@@ -8,46 +8,6 @@
8#include <QDockWidget> 8#include <QDockWidget>
9#include <QTimer> 9#include <QTimer>
10#include "common/microprofile.h" 10#include "common/microprofile.h"
11#include "common/profiler_reporting.h"
12#include "ui_profiler.h"
13
14class ProfilerModel : public QAbstractItemModel {
15 Q_OBJECT
16
17public:
18 explicit ProfilerModel(QObject* parent);
19
20 QVariant headerData(int section, Qt::Orientation orientation,
21 int role = Qt::DisplayRole) const override;
22 QModelIndex index(int row, int column,
23 const QModelIndex& parent = QModelIndex()) const override;
24 QModelIndex parent(const QModelIndex& child) const override;
25 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
26 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
27 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
28
29public slots:
30 void updateProfilingInfo();
31
32private:
33 Common::Profiling::AggregatedFrameResult results;
34};
35
36class ProfilerWidget : public QDockWidget {
37 Q_OBJECT
38
39public:
40 explicit ProfilerWidget(QWidget* parent = nullptr);
41
42private slots:
43 void setProfilingInfoUpdateEnabled(bool enable);
44
45private:
46 Ui::Profiler ui;
47 ProfilerModel* model;
48
49 QTimer update_timer;
50};
51 11
52class MicroProfileDialog : public QWidget { 12class MicroProfileDialog : public QWidget {
53 Q_OBJECT 13 Q_OBJECT
diff --git a/src/citra_qt/debugger/profiler.ui b/src/citra_qt/debugger/profiler.ui
deleted file mode 100644
index d3c9a9a1f..000000000
--- a/src/citra_qt/debugger/profiler.ui
+++ /dev/null
@@ -1,33 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>Profiler</class>
4 <widget class="QDockWidget" name="Profiler">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>400</width>
10 <height>300</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Profiler</string>
15 </property>
16 <widget class="QWidget" name="dockWidgetContents">
17 <layout class="QVBoxLayout" name="verticalLayout">
18 <item>
19 <widget class="QTreeView" name="treeView">
20 <property name="alternatingRowColors">
21 <bool>true</bool>
22 </property>
23 <property name="uniformRowHeights">
24 <bool>true</bool>
25 </property>
26 </widget>
27 </item>
28 </layout>
29 </widget>
30 </widget>
31 <resources/>
32 <connections/>
33</ui>