summaryrefslogtreecommitdiffstats
path: root/src/citra_qt/debugger
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-02-20 03:35:04 +0100
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-02-27 02:22:03 +0100
commit3b4e4003336c94527339a2a9ad7d52875974258f (patch)
tree18e6e1125ff486ff3f9bd2985af7830cd7838f22 /src/citra_qt/debugger
parentPerfStats: Add method to get the instantaneous time ratio (diff)
downloadyuzu-3b4e4003336c94527339a2a9ad7d52875974258f.tar
yuzu-3b4e4003336c94527339a2a9ad7d52875974258f.tar.gz
yuzu-3b4e4003336c94527339a2a9ad7d52875974258f.tar.bz2
yuzu-3b4e4003336c94527339a2a9ad7d52875974258f.tar.lz
yuzu-3b4e4003336c94527339a2a9ad7d52875974258f.tar.xz
yuzu-3b4e4003336c94527339a2a9ad7d52875974258f.tar.zst
yuzu-3b4e4003336c94527339a2a9ad7d52875974258f.zip
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 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <QAction>
+#include <QLayout>
#include <QMouseEvent>
#include <QPainter>
#include <QString>
@@ -9,121 +11,12 @@
#include "citra_qt/util/util.h"
#include "common/common_types.h"
#include "common/microprofile.h"
-#include "common/profiler_reporting.h"
// Include the implementation of the UI in this file. This isn't in microprofile.cpp because the
// non-Qt frontends don't need it (and don't implement the UI drawing hooks either).
#if MICROPROFILE_ENABLED
#define MICROPROFILEUI_IMPL 1
#include "common/microprofileui.h"
-#endif
-
-using namespace Common::Profiling;
-
-static QVariant GetDataForColumn(int col, const AggregatedDuration& duration) {
- static auto duration_to_float = [](Duration dur) -> float {
- using FloatMs = std::chrono::duration<float, std::chrono::milliseconds::period>;
- return std::chrono::duration_cast<FloatMs>(dur).count();
- };
-
- switch (col) {
- case 1:
- return duration_to_float(duration.avg);
- case 2:
- return duration_to_float(duration.min);
- case 3:
- return duration_to_float(duration.max);
- default:
- return QVariant();
- }
-}
-
-ProfilerModel::ProfilerModel(QObject* parent) : QAbstractItemModel(parent) {
- updateProfilingInfo();
-}
-
-QVariant ProfilerModel::headerData(int section, Qt::Orientation orientation, int role) const {
- if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
- switch (section) {
- case 0:
- return tr("Category");
- case 1:
- return tr("Avg");
- case 2:
- return tr("Min");
- case 3:
- return tr("Max");
- }
- }
-
- return QVariant();
-}
-
-QModelIndex ProfilerModel::index(int row, int column, const QModelIndex& parent) const {
- return createIndex(row, column);
-}
-
-QModelIndex ProfilerModel::parent(const QModelIndex& child) const {
- return QModelIndex();
-}
-
-int ProfilerModel::columnCount(const QModelIndex& parent) const {
- return 4;
-}
-
-int ProfilerModel::rowCount(const QModelIndex& parent) const {
- if (parent.isValid()) {
- return 0;
- } else {
- return 2;
- }
-}
-
-QVariant ProfilerModel::data(const QModelIndex& index, int role) const {
- if (role == Qt::DisplayRole) {
- if (index.row() == 0) {
- if (index.column() == 0) {
- return tr("Frame");
- } else {
- return GetDataForColumn(index.column(), results.frame_time);
- }
- } else if (index.row() == 1) {
- if (index.column() == 0) {
- return tr("Frame (with swapping)");
- } else {
- return GetDataForColumn(index.column(), results.interframe_time);
- }
- }
- }
-
- return QVariant();
-}
-
-void ProfilerModel::updateProfilingInfo() {
- results = GetTimingResultsAggregator()->GetAggregatedResults();
- emit dataChanged(createIndex(0, 1), createIndex(rowCount() - 1, 3));
-}
-
-ProfilerWidget::ProfilerWidget(QWidget* parent) : QDockWidget(parent) {
- ui.setupUi(this);
-
- model = new ProfilerModel(this);
- ui.treeView->setModel(model);
-
- connect(this, SIGNAL(visibilityChanged(bool)), SLOT(setProfilingInfoUpdateEnabled(bool)));
- connect(&update_timer, SIGNAL(timeout()), model, SLOT(updateProfilingInfo()));
-}
-
-void ProfilerWidget::setProfilingInfoUpdateEnabled(bool enable) {
- if (enable) {
- update_timer.start(100);
- model->updateProfilingInfo();
- } else {
- update_timer.stop();
- }
-}
-
-#if MICROPROFILE_ENABLED
class MicroProfileWidget : public QWidget {
public:
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 @@
#include <QDockWidget>
#include <QTimer>
#include "common/microprofile.h"
-#include "common/profiler_reporting.h"
-#include "ui_profiler.h"
-
-class ProfilerModel : public QAbstractItemModel {
- Q_OBJECT
-
-public:
- explicit ProfilerModel(QObject* parent);
-
- QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const override;
- QModelIndex index(int row, int column,
- const QModelIndex& parent = QModelIndex()) const override;
- QModelIndex parent(const QModelIndex& child) const override;
- int columnCount(const QModelIndex& parent = QModelIndex()) const override;
- int rowCount(const QModelIndex& parent = QModelIndex()) const override;
- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
-
-public slots:
- void updateProfilingInfo();
-
-private:
- Common::Profiling::AggregatedFrameResult results;
-};
-
-class ProfilerWidget : public QDockWidget {
- Q_OBJECT
-
-public:
- explicit ProfilerWidget(QWidget* parent = nullptr);
-
-private slots:
- void setProfilingInfoUpdateEnabled(bool enable);
-
-private:
- Ui::Profiler ui;
- ProfilerModel* model;
-
- QTimer update_timer;
-};
class MicroProfileDialog : public QWidget {
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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Profiler</class>
- <widget class="QDockWidget" name="Profiler">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Profiler</string>
- </property>
- <widget class="QWidget" name="dockWidgetContents">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QTreeView" name="treeView">
- <property name="alternatingRowColors">
- <bool>true</bool>
- </property>
- <property name="uniformRowHeights">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>