Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickprofiler_p.h |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | struct __attribute__((visibility("default"))) QQuickProfilerData | - | ||||||||||||
8 | { | - | ||||||||||||
9 | QQuickProfilerData() {} | - | ||||||||||||
10 | - | |||||||||||||
11 | QQuickProfilerData(qint64 time, int messageType, int detailType, const QUrl &url, int x = 0, | - | ||||||||||||
12 | int y = 0, int framerate = 0, int count = 0) : | - | ||||||||||||
13 | time(time), messageType(messageType), detailType(detailType), detailUrl(url), x(x), y(y), | - | ||||||||||||
14 | framerate(framerate), count(count) {} never executed: end of block | 0 | ||||||||||||
15 | - | |||||||||||||
16 | QQuickProfilerData(qint64 time, int messageType, int detailType, int framerateOrInputType = 0, | - | ||||||||||||
17 | int countOrInputA = 0, int threadIdOrInputB = 0) : | - | ||||||||||||
18 | time(time), messageType(messageType), detailType(detailType), | - | ||||||||||||
19 | framerate(framerateOrInputType), count(countOrInputA), threadId(threadIdOrInputB) {} executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
20 | - | |||||||||||||
21 | - | |||||||||||||
22 | - | |||||||||||||
23 | QQuickProfilerData(qint64 time, int messageType, int detailType, qint64 d1, qint64 d2, | - | ||||||||||||
24 | qint64 d3, qint64 d4, qint64 d5) : | - | ||||||||||||
25 | time(time), messageType(messageType), detailType(detailType), subtime_1(d1), subtime_2(d2), | - | ||||||||||||
26 | subtime_3(d3), subtime_4(d4), subtime_5(d5) {} never executed: end of block | 0 | ||||||||||||
27 | - | |||||||||||||
28 | - | |||||||||||||
29 | qint64 time; | - | ||||||||||||
30 | int messageType; | - | ||||||||||||
31 | int detailType; | - | ||||||||||||
32 | - | |||||||||||||
33 | QUrl detailUrl; | - | ||||||||||||
34 | - | |||||||||||||
35 | union { | - | ||||||||||||
36 | qint64 subtime_1; | - | ||||||||||||
37 | int x; | - | ||||||||||||
38 | }; | - | ||||||||||||
39 | - | |||||||||||||
40 | union { | - | ||||||||||||
41 | qint64 subtime_2; | - | ||||||||||||
42 | int y; | - | ||||||||||||
43 | }; | - | ||||||||||||
44 | - | |||||||||||||
45 | union { | - | ||||||||||||
46 | qint64 subtime_3; | - | ||||||||||||
47 | int framerate; | - | ||||||||||||
48 | int inputType; | - | ||||||||||||
49 | }; | - | ||||||||||||
50 | - | |||||||||||||
51 | union { | - | ||||||||||||
52 | qint64 subtime_4; | - | ||||||||||||
53 | int count; | - | ||||||||||||
54 | int inputA; | - | ||||||||||||
55 | }; | - | ||||||||||||
56 | - | |||||||||||||
57 | union { | - | ||||||||||||
58 | qint64 subtime_5; | - | ||||||||||||
59 | int threadId; | - | ||||||||||||
60 | int inputB; | - | ||||||||||||
61 | }; | - | ||||||||||||
62 | }; | - | ||||||||||||
63 | - | |||||||||||||
64 | template<> class QTypeInfo<QQuickProfilerData > { public: enum { isSpecialized = true, isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_MOVABLE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QQuickProfilerData)>sizeof(void*)), isPointer = false, isIntegral = std::is_integral< QQuickProfilerData >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QQuickProfilerData) }; static inline const char *name() { return "QQuickProfilerData"; } }; | - | ||||||||||||
65 | - | |||||||||||||
66 | class QQuickProfilerSceneGraphData : public QQmlProfilerDefinitions { | - | ||||||||||||
67 | private: | - | ||||||||||||
68 | static const uint s_numSceneGraphTimings = 5; | - | ||||||||||||
69 | - | |||||||||||||
70 | template<uint size> | - | ||||||||||||
71 | struct TimingData { | - | ||||||||||||
72 | qint64 values[size][s_numSceneGraphTimings + 1]; | - | ||||||||||||
73 | }; | - | ||||||||||||
74 | - | |||||||||||||
75 | QThreadStorage<TimingData<NumRenderThreadFrameTypes> > renderThreadTimings; | - | ||||||||||||
76 | TimingData<NumGUIThreadFrameTypes> guiThreadTimings; | - | ||||||||||||
77 | - | |||||||||||||
78 | public: | - | ||||||||||||
79 | template<SceneGraphFrameType type> | - | ||||||||||||
80 | qint64 *timings() | - | ||||||||||||
81 | { | - | ||||||||||||
82 | if (type < NumRenderThreadFrameTypes
| 0 | ||||||||||||
83 | return never executed: renderThreadTimings.localData().values[type];return renderThreadTimings.localData().values[type]; never executed: return renderThreadTimings.localData().values[type]; | 0 | ||||||||||||
84 | else | - | ||||||||||||
85 | return never executed: guiThreadTimings.values[type - NumRenderThreadFrameTypes];return guiThreadTimings.values[type - NumRenderThreadFrameTypes]; never executed: return guiThreadTimings.values[type - NumRenderThreadFrameTypes]; | 0 | ||||||||||||
86 | } | - | ||||||||||||
87 | }; | - | ||||||||||||
88 | - | |||||||||||||
89 | class __attribute__((visibility("default"))) QQuickProfiler : public QObject, public QQmlProfilerDefinitions { | - | ||||||||||||
90 | public: | - | ||||||||||||
91 | #pragma GCC diagnostic push | - | ||||||||||||
92 | - | |||||||||||||
93 | #pragma GCC diagnostic ignored "-Wsuggest-override" | - | ||||||||||||
94 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: | - | ||||||||||||
95 | #pragma GCC diagnostic ignored "-Wattributes" | - | ||||||||||||
96 | __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||
97 | #pragma GCC diagnostic pop | - | ||||||||||||
98 | struct QPrivateSignal {}; | - | ||||||||||||
99 | public: | - | ||||||||||||
100 | - | |||||||||||||
101 | enum AnimationThread { | - | ||||||||||||
102 | GuiThread, | - | ||||||||||||
103 | RenderThread | - | ||||||||||||
104 | }; | - | ||||||||||||
105 | - | |||||||||||||
106 | enum SceneGraphContextStage { | - | ||||||||||||
107 | SceneGraphContextStart, | - | ||||||||||||
108 | SceneGraphContextMaterialCompile | - | ||||||||||||
109 | }; | - | ||||||||||||
110 | - | |||||||||||||
111 | enum SceneGraphRendererStage { | - | ||||||||||||
112 | SceneGraphRendererStart, | - | ||||||||||||
113 | SceneGraphRendererPreprocess, | - | ||||||||||||
114 | SceneGraphRendererUpdate, | - | ||||||||||||
115 | SceneGraphRendererBinding, | - | ||||||||||||
116 | SceneGraphRendererRender | - | ||||||||||||
117 | }; | - | ||||||||||||
118 | - | |||||||||||||
119 | enum SceneGraphAdaptationLayerStage { | - | ||||||||||||
120 | SceneGraphAdaptationLayerStart, | - | ||||||||||||
121 | SceneGraphAdaptationLayerGlyphRender, | - | ||||||||||||
122 | SceneGraphAdaptationLayerGlyphStore | - | ||||||||||||
123 | }; | - | ||||||||||||
124 | - | |||||||||||||
125 | enum SceneGraphRenderLoopStage { | - | ||||||||||||
126 | SceneGraphRenderLoopStart, | - | ||||||||||||
127 | SceneGraphRenderLoopSync, | - | ||||||||||||
128 | SceneGraphRenderLoopRender, | - | ||||||||||||
129 | SceneGraphRenderLoopSwap | - | ||||||||||||
130 | }; | - | ||||||||||||
131 | - | |||||||||||||
132 | enum SceneGraphPolishStage { | - | ||||||||||||
133 | SceneGraphPolishStart, | - | ||||||||||||
134 | SceneGraphPolishPolish | - | ||||||||||||
135 | }; | - | ||||||||||||
136 | - | |||||||||||||
137 | enum SceneGraphPolishAndSyncStage { | - | ||||||||||||
138 | SceneGraphPolishAndSyncStart, | - | ||||||||||||
139 | SceneGraphPolishAndSyncPolish, | - | ||||||||||||
140 | SceneGraphPolishAndSyncWait, | - | ||||||||||||
141 | SceneGraphPolishAndSyncSync, | - | ||||||||||||
142 | SceneGraphPolishAndSyncAnimations | - | ||||||||||||
143 | }; | - | ||||||||||||
144 | - | |||||||||||||
145 | enum SceneGraphTexturePrepareStage { | - | ||||||||||||
146 | SceneGraphTexturePrepareStart, | - | ||||||||||||
147 | SceneGraphTexturePrepareBind, | - | ||||||||||||
148 | SceneGraphTexturePrepareConvert, | - | ||||||||||||
149 | SceneGraphTexturePrepareSwizzle, | - | ||||||||||||
150 | SceneGraphTexturePrepareUpload, | - | ||||||||||||
151 | SceneGraphTexturePrepareMipmap | - | ||||||||||||
152 | }; | - | ||||||||||||
153 | - | |||||||||||||
154 | enum SceneGraphTextureDeletionStage { | - | ||||||||||||
155 | SceneGraphTextureDeletionStart, | - | ||||||||||||
156 | SceneGraphTextureDeletionDelete | - | ||||||||||||
157 | }; | - | ||||||||||||
158 | - | |||||||||||||
159 | template<EventType DetailType, InputEventType InputType> | - | ||||||||||||
160 | static void inputEvent(int x, int y = 0) | - | ||||||||||||
161 | { | - | ||||||||||||
162 | s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), 1 << Event, | - | ||||||||||||
163 | 1 << DetailType, InputType, x, y)); | - | ||||||||||||
164 | } never executed: end of block | 0 | ||||||||||||
165 | - | |||||||||||||
166 | static void animationFrame(qint64 delta, AnimationThread threadId) | - | ||||||||||||
167 | { | - | ||||||||||||
168 | int animCount = QUnifiedTimer::instance()->runningAnimationCount(); | - | ||||||||||||
169 | - | |||||||||||||
170 | if (animCount > 0
| 0-6 | ||||||||||||
171 | s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), 1 << Event, | - | ||||||||||||
172 | 1 << AnimationFrame, 1000 / (int)delta , animCount, | - | ||||||||||||
173 | threadId)); | - | ||||||||||||
174 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
175 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
176 | - | |||||||||||||
177 | template<SceneGraphFrameType FrameType1, SceneGraphFrameType FrameType2> | - | ||||||||||||
178 | static void startSceneGraphFrame() | - | ||||||||||||
179 | { | - | ||||||||||||
180 | startSceneGraphFrame<FrameType1>(); | - | ||||||||||||
181 | s_instance->m_sceneGraphData.timings<FrameType2>()[0] = | - | ||||||||||||
182 | s_instance->m_sceneGraphData.timings<FrameType1>()[0]; | - | ||||||||||||
183 | } never executed: end of block | 0 | ||||||||||||
184 | - | |||||||||||||
185 | template<SceneGraphFrameType FrameType> | - | ||||||||||||
186 | static void startSceneGraphFrame() | - | ||||||||||||
187 | { | - | ||||||||||||
188 | s_instance->m_sceneGraphData.timings<FrameType>()[0] = s_instance->timestamp(); | - | ||||||||||||
189 | } never executed: end of block | 0 | ||||||||||||
190 | - | |||||||||||||
191 | template<SceneGraphFrameType FrameType> | - | ||||||||||||
192 | static void recordSceneGraphTimestamp(uint position) | - | ||||||||||||
193 | { | - | ||||||||||||
194 | s_instance->m_sceneGraphData.timings<FrameType>()[position] = s_instance->timestamp(); | - | ||||||||||||
195 | } never executed: end of block | 0 | ||||||||||||
196 | - | |||||||||||||
197 | template<SceneGraphFrameType FrameType, uint Skip> | - | ||||||||||||
198 | static void skipSceneGraphTimestamps(uint position) | - | ||||||||||||
199 | { | - | ||||||||||||
200 | qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>(); | - | ||||||||||||
201 | const qint64 last = timings[position]; | - | ||||||||||||
202 | for (uint i = 0; i < Skip
| 0 | ||||||||||||
203 | timings[++position] = last; never executed: timings[++position] = last; | 0 | ||||||||||||
204 | } never executed: end of block | 0 | ||||||||||||
205 | - | |||||||||||||
206 | template<SceneGraphFrameType FrameType, bool Record> | - | ||||||||||||
207 | static void reportSceneGraphFrame(uint position, quint64 payload = ~0) | - | ||||||||||||
208 | { | - | ||||||||||||
209 | qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>(); | - | ||||||||||||
210 | if (Record
| 0 | ||||||||||||
211 | timings[position] = s_instance->timestamp(); never executed: timings[position] = s_instance->timestamp(); | 0 | ||||||||||||
212 | s_instance->processMessage(QQuickProfilerData( | - | ||||||||||||
213 | timings[position], 1 << SceneGraphFrame, 1 << FrameType, | - | ||||||||||||
214 | position > 0 ? timings[1] - timings[0] : payload, | - | ||||||||||||
215 | position > 1 ? timings[2] - timings[1] : payload, | - | ||||||||||||
216 | position > 2 ? timings[3] - timings[2] : payload, | - | ||||||||||||
217 | position > 3 ? timings[4] - timings[3] : payload, | - | ||||||||||||
218 | position > 4 ? timings[5] - timings[4] : payload)); | - | ||||||||||||
219 | } never executed: end of block | 0 | ||||||||||||
220 | - | |||||||||||||
221 | template<SceneGraphFrameType FrameType, bool Record, SceneGraphFrameType SwitchTo> | - | ||||||||||||
222 | static void reportSceneGraphFrame(uint position, quint64 payload = ~0) | - | ||||||||||||
223 | { | - | ||||||||||||
224 | reportSceneGraphFrame<FrameType, Record>(position, payload); | - | ||||||||||||
225 | s_instance->m_sceneGraphData.timings<SwitchTo>()[0] = | - | ||||||||||||
226 | s_instance->m_sceneGraphData.timings<FrameType>()[position]; | - | ||||||||||||
227 | } never executed: end of block | 0 | ||||||||||||
228 | - | |||||||||||||
229 | template<PixmapEventType PixmapState> | - | ||||||||||||
230 | static void pixmapStateChanged(const QUrl &url) | - | ||||||||||||
231 | { | - | ||||||||||||
232 | s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), | - | ||||||||||||
233 | 1 << PixmapCacheEvent, 1 << PixmapState, url)); | - | ||||||||||||
234 | } never executed: end of block | 0 | ||||||||||||
235 | - | |||||||||||||
236 | static void pixmapLoadingFinished(const QUrl &url, const QSize &size) | - | ||||||||||||
237 | { | - | ||||||||||||
238 | s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), | - | ||||||||||||
239 | 1 << PixmapCacheEvent, | - | ||||||||||||
240 | (1 << PixmapLoadingFinished) | ((size.width() > 0 && size.height() > 0) ? (1 << PixmapSizeKnown) : 0), | - | ||||||||||||
241 | url, size.width(), size.height())); | - | ||||||||||||
242 | } never executed: end of block | 0 | ||||||||||||
243 | - | |||||||||||||
244 | template<PixmapEventType CountType> | - | ||||||||||||
245 | static void pixmapCountChanged(const QUrl &url, int count) | - | ||||||||||||
246 | { | - | ||||||||||||
247 | s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), | - | ||||||||||||
248 | 1 << PixmapCacheEvent, 1 << CountType, url, 0, 0, 0, count)); | - | ||||||||||||
249 | } never executed: end of block | 0 | ||||||||||||
250 | - | |||||||||||||
251 | static void registerAnimationCallback(); | - | ||||||||||||
252 | - | |||||||||||||
253 | qint64 timestamp() { return executed 6 times by 1 test: m_timer.nsecsElapsed();return m_timer.nsecsElapsed(); Executed by:
executed 6 times by 1 test: }return m_timer.nsecsElapsed(); Executed by:
| 6 | ||||||||||||
254 | - | |||||||||||||
255 | static quint64 featuresEnabled; | - | ||||||||||||
256 | - | |||||||||||||
257 | static void initialize(QObject *parent); | - | ||||||||||||
258 | - | |||||||||||||
259 | ~QQuickProfiler() override; | - | ||||||||||||
260 | - | |||||||||||||
261 | public : | - | ||||||||||||
262 | void dataReady(const QVector<QQuickProfilerData> &data); | - | ||||||||||||
263 | - | |||||||||||||
264 | protected: | - | ||||||||||||
265 | friend class QQuickProfilerAdapter; | - | ||||||||||||
266 | - | |||||||||||||
267 | static QQuickProfiler *s_instance; | - | ||||||||||||
268 | QMutex m_dataMutex; | - | ||||||||||||
269 | QElapsedTimer m_timer; | - | ||||||||||||
270 | QVector<QQuickProfilerData> m_data; | - | ||||||||||||
271 | QQuickProfilerSceneGraphData m_sceneGraphData; | - | ||||||||||||
272 | - | |||||||||||||
273 | QQuickProfiler(QObject *parent); | - | ||||||||||||
274 | - | |||||||||||||
275 | void processMessage(const QQuickProfilerData &message) | - | ||||||||||||
276 | { | - | ||||||||||||
277 | QMutexLocker lock(&m_dataMutex); | - | ||||||||||||
278 | m_data.append(message); | - | ||||||||||||
279 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
280 | - | |||||||||||||
281 | void startProfilingImpl(quint64 features); | - | ||||||||||||
282 | void stopProfilingImpl(); | - | ||||||||||||
283 | void reportDataImpl(); | - | ||||||||||||
284 | void setTimer(const QElapsedTimer &t); | - | ||||||||||||
285 | }; | - | ||||||||||||
286 | - | |||||||||||||
Switch to Source code | Preprocessed file |