1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QQMLPROFILERCLIENT_P_P_H |
5 | #define QQMLPROFILERCLIENT_P_P_H |
6 | |
7 | #include "qqmldebugclient_p_p.h" |
8 | #include "qqmldebugmessageclient_p.h" |
9 | #include "qqmlenginecontrolclient_p.h" |
10 | #include "qqmlprofilerclient_p.h" |
11 | #include "qqmlprofilertypedevent_p.h" |
12 | #include "qqmlprofilerclientdefinitions_p.h" |
13 | |
14 | #include <QtCore/qqueue.h> |
15 | #include <QtCore/qstack.h> |
16 | |
17 | // |
18 | // W A R N I N G |
19 | // ------------- |
20 | // |
21 | // This file is not part of the Qt API. It exists purely as an |
22 | // implementation detail. This header file may change from version to |
23 | // version without notice, or even be removed. |
24 | // |
25 | // We mean it. |
26 | // |
27 | |
28 | QT_BEGIN_NAMESPACE |
29 | |
30 | class QQmlProfilerClientPrivate : public QQmlDebugClientPrivate { |
31 | Q_DECLARE_PUBLIC(QQmlProfilerClient) |
32 | public: |
33 | QQmlProfilerClientPrivate(QQmlDebugConnection *connection, |
34 | QQmlProfilerEventReceiver *eventReceiver) |
35 | : QQmlDebugClientPrivate(QLatin1String("CanvasFrameRate" ), connection) |
36 | , eventReceiver(eventReceiver) |
37 | , engineControl(new QQmlEngineControlClient(connection)) |
38 | , maximumTime(0) |
39 | , recording(false) |
40 | , requestedFeatures(0) |
41 | , recordedFeatures(0) |
42 | , flushInterval(0) |
43 | { |
44 | } |
45 | |
46 | ~QQmlProfilerClientPrivate() override; |
47 | |
48 | void sendRecordingStatus(int engineId); |
49 | bool updateFeatures(ProfileFeature feature); |
50 | int resolveType(const QQmlProfilerTypedEvent &type); |
51 | int resolveStackTop(); |
52 | void forwardEvents(const QQmlProfilerEvent &last); |
53 | void forwardDebugMessages(qint64 untilTimestamp); |
54 | void processCurrentEvent(); |
55 | void finalize(); |
56 | |
57 | QQmlProfilerEventReceiver *eventReceiver; |
58 | QScopedPointer<QQmlEngineControlClient> engineControl; |
59 | QScopedPointer<QQmlDebugMessageClient> messageClient; |
60 | qint64 maximumTime; |
61 | bool recording; |
62 | quint64 requestedFeatures; |
63 | quint64 recordedFeatures; |
64 | quint32 flushInterval; |
65 | |
66 | // Reuse the same event, so that we don't have to constantly reallocate all the data. |
67 | QQmlProfilerTypedEvent currentEvent; |
68 | QHash<QQmlProfilerEventType, int> eventTypeIds; |
69 | QHash<qint64, int> serverTypeIds; |
70 | QStack<QQmlProfilerTypedEvent> rangesInProgress; |
71 | QQueue<QQmlProfilerEvent> pendingMessages; |
72 | QQueue<QQmlProfilerEvent> pendingDebugMessages; |
73 | |
74 | QList<int> trackedEngines; |
75 | }; |
76 | |
77 | QT_END_NAMESPACE |
78 | |
79 | #endif // QQMLPROFILERCLIENT_P_P_H |
80 | |