profiler.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/profiler_reporting.h"
  10. class ProfilerModel : public QAbstractItemModel
  11. {
  12. Q_OBJECT
  13. public:
  14. ProfilerModel(QObject* parent);
  15. QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
  16. QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
  17. QModelIndex parent(const QModelIndex& child) const override;
  18. int columnCount(const QModelIndex& parent = QModelIndex()) const override;
  19. int rowCount(const QModelIndex& parent = QModelIndex()) const override;
  20. QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
  21. public slots:
  22. void updateProfilingInfo();
  23. private:
  24. Common::Profiling::AggregatedFrameResult results;
  25. };
  26. class ProfilerWidget : public QDockWidget
  27. {
  28. Q_OBJECT
  29. public:
  30. ProfilerWidget(QWidget* parent = 0);
  31. private slots:
  32. void setProfilingInfoUpdateEnabled(bool enable);
  33. private:
  34. Ui::Profiler ui;
  35. ProfilerModel* model;
  36. QTimer update_timer;
  37. };
  38. class MicroProfileDialog : public QWidget {
  39. Q_OBJECT
  40. public:
  41. MicroProfileDialog(QWidget* parent = 0);
  42. /// Returns a QAction that can be used to toggle visibility of this dialog.
  43. QAction* toggleViewAction();
  44. protected:
  45. void showEvent(QShowEvent* ev) override;
  46. void hideEvent(QHideEvent* ev) override;
  47. private:
  48. QAction* toggle_view_action = nullptr;
  49. };