MythTV  master
mythopenglperf.h
Go to the documentation of this file.
1 #ifndef MYTHOPENGLPERF_H
2 #define MYTHOPENGLPERF_H
3 
4 // Qt
5 #include <QVector>
6 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
7 #include <QOpenGLTimeMonitor>
8 #else
9 #include <QtOpenGL/QOpenGLTimeMonitor>
10 #endif
11 
12 // QOpenGLTimeMonitor is not available with Qt GLES2 builds
13 #if defined(QT_OPENGL_ES_2) || (QT_FEATURE_opengles2 == 1)
14 
15 #ifndef GLuint64
16 using GLuint64 = uint64_t;
17 #endif
18 
19 class QOpenGLTimeMonitor
20 {
21  public:
22  QOpenGLTimeMonitor() {};
23  void setSampleCount(int) {};
24  int sampleCount() const { return 0; };
25  bool create() { return false; };
26  bool isCreated() const { return false; };
27  int recordSample() { return 0; };
28  bool isResultAvailable() const { return false; };
29  QVector<GLuint64> waitForIntervals() const { return QVector<GLuint64>(); };
30  void reset() {};
31 };
32 #endif
33 
34 // MythTV
35 #include "libmythui/mythuiexp.h"
36 
37 class MUI_PUBLIC MythOpenGLPerf : public QOpenGLTimeMonitor
38 {
39  public:
40  MythOpenGLPerf(QString Name, QVector<QString> Names, int SampleCount = 30);
41  void RecordSample (void);
42  void LogSamples (void);
43  int GetTimersRunning(void) const;
44 
45  private:
46  QString m_name;
47  int m_sampleCount { 0 };
48  int m_totalSamples { 30 };
49  bool m_timersReady { true };
50  int m_timersRunning { 0 };
51  QVector<GLuint64> m_timerData { 0 };
52  QVector<QString> m_timerNames;
53 };
54 
55 #endif // MYTHOPENGLPERF_H
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
MythOpenGLPerf::m_timerNames
QVector< QString > m_timerNames
Definition: mythopenglperf.h:52
MythOpenGLPerf
A simple overload of QOpenGLTimeMonitor to record and log OpenGL execution intervals.
Definition: mythopenglperf.h:37
Name
Definition: channelsettings.cpp:71
MythOpenGLPerf::m_name
QString m_name
Definition: mythopenglperf.h:46
mythuiexp.h