profiler.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2015 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <QAbstractItemModel>
  6. #include <QDockWidget>
  7. #include <QTimer>
  8. #include "ui_profiler.h"
  9. #include "common/microprofile.h"
  10. #include "common/profiler_reporting.h"
  11. class ProfilerModel : public QAbstractItemModel
  12. {
  13. Q_OBJECT
  14. public:
  15. ProfilerModel(QObject* parent);
  16. QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
  17. QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
  18. QModelIndex parent(const QModelIndex& child) const override;
  19. int columnCount(const QModelIndex& parent = QModelIndex()) const override;
  20. int rowCount(const QModelIndex& parent = QModelIndex()) const override;
  21. QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
  22. public slots:
  23. void updateProfilingInfo();
  24. private:
  25. Common::Profiling::AggregatedFrameResult results;
  26. };
  27. class ProfilerWidget : public QDockWidget
  28. {
  29. Q_OBJECT
  30. public:
  31. ProfilerWidget(QWidget* parent = nullptr);
  32. private slots:
  33. void setProfilingInfoUpdateEnabled(bool enable);
  34. private:
  35. Ui::Profiler ui;
  36. ProfilerModel* model;
  37. QTimer update_timer;
  38. };
  39. class MicroProfileDialog : public QWidget {
  40. Q_OBJECT
  41. public:
  42. MicroProfileDialog(QWidget* parent = nullptr);
  43. /// Returns a QAction that can be used to toggle visibility of this dialog.
  44. QAction* toggleViewAction();
  45. protected:
  46. void showEvent(QShowEvent* ev) override;
  47. void hideEvent(QHideEvent* ev) override;
  48. private:
  49. QAction* toggle_view_action = nullptr;
  50. };