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
16using GLuint64 = uint64_t;
17#endif
18
19// This defines the Qt QOpenGLTimeMonitor class (for those systems
20// whose Qt doesn't have it). This has to match the Qt definition of
21// the class.
22//
23// NOLINTBEGIN(readability-convert-member-functions-to-static)
24class QOpenGLTimeMonitor
25{
26 public:
27 QOpenGLTimeMonitor() = default;
28 void setSampleCount(int /*count*/) {};
29 int sampleCount() { return 0; };
30 bool create() { return false; };
31 bool isCreated() { return false; };
32 int recordSample() { return 0; };
33 bool isResultAvailable() { return false; };
34 QVector<GLuint64> waitForIntervals() { return {}; };
35 void reset() {};
36};
37// NOLINTEND(readability-convert-member-functions-to-static)
38#endif
39
40// MythTV
41#include "libmythui/mythuiexp.h"
42
43class MUI_PUBLIC MythOpenGLPerf : public QOpenGLTimeMonitor
44{
45 public:
46 MythOpenGLPerf(QString Name, QVector<QString> Names, int SampleCount = 30);
47 void RecordSample (void);
48 void LogSamples (void);
49 int GetTimersRunning(void) const;
50
51 private:
52 QString m_name;
53 int m_sampleCount { 0 };
54 int m_totalSamples { 30 };
55 bool m_timersReady { true };
56 int m_timersRunning { 0 };
57 QVector<GLuint64> m_timerData { 0 };
58 QVector<QString> m_timerNames;
59};
60
61#endif // MYTHOPENGLPERF_H
A simple overload of QOpenGLTimeMonitor to record and log OpenGL execution intervals.
QVector< QString > m_timerNames
#define MUI_PUBLIC
Definition: mythuiexp.h:9