16QQuickProfilerAdapter::QQuickProfilerAdapter(QObject *parent) :
17 QQmlAbstractProfilerAdapter(parent), next(0)
19 QQuickProfiler::initialize(
this);
22 connect(
this, &QQmlAbstractProfilerAdapter::profilingEnabled,
23 QQuickProfiler::s_instance, &QQuickProfiler::startProfilingImpl, Qt::DirectConnection);
24 connect(
this, &QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting,
25 QQuickProfiler::s_instance, &QQuickProfiler::startProfilingImpl, Qt::DirectConnection);
26 connect(
this, &QQmlAbstractProfilerAdapter::referenceTimeKnown,
27 QQuickProfiler::s_instance, &QQuickProfiler::setTimer, Qt::DirectConnection);
28 connect(
this, &QQmlAbstractProfilerAdapter::profilingDisabled,
29 QQuickProfiler::s_instance, &QQuickProfiler::stopProfilingImpl, Qt::DirectConnection);
30 connect(
this, &QQmlAbstractProfilerAdapter::profilingDisabledWhileWaiting,
31 QQuickProfiler::s_instance, &QQuickProfiler::stopProfilingImpl, Qt::DirectConnection);
32 connect(
this, &QQmlAbstractProfilerAdapter::dataRequested,
33 QQuickProfiler::s_instance, &QQuickProfiler::reportDataImpl, Qt::DirectConnection);
34 connect(QQuickProfiler::s_instance, &QQuickProfiler::dataReady,
35 this, &QQuickProfilerAdapter::receiveData, Qt::DirectConnection);
46 QList<QByteArray> &messages)
49 Q_ASSERT_X(((data.messageType | data.detailType) & (1 << 31)) == 0, Q_FUNC_INFO,
50 "You can use at most 31 message types and 31 detail types.");
51 for (uint decodedMessageType = 0; (data.messageType >> decodedMessageType) != 0;
52 ++decodedMessageType) {
53 if ((data.messageType & (1 << decodedMessageType)) == 0)
56 for (uint decodedDetailType = 0; (data.detailType >> decodedDetailType) != 0;
57 ++decodedDetailType) {
58 if ((data.detailType & (1 << decodedDetailType)) == 0)
61 ds << data.time << decodedMessageType << decodedDetailType;
63 switch (decodedMessageType) {
64 case QQuickProfiler::Event:
65 switch (decodedDetailType) {
66 case QQuickProfiler::AnimationFrame:
67 ds << data.framerate << data.count << data.threadId;
69 case QQuickProfiler::Key:
70 case QQuickProfiler::Mouse:
71 ds << data.inputType << data.inputA << data.inputB;
75 case QQuickProfiler::PixmapCacheEvent:
76 ds << data.detailUrl.toString();
77 switch (decodedDetailType) {
78 case QQuickProfiler::PixmapSizeKnown: ds << data.x << data.y;
break;
79 case QQuickProfiler::PixmapReferenceCountChanged: ds << data.count;
break;
80 case QQuickProfiler::PixmapCacheCountChanged: ds << data.count;
break;
84 case QQuickProfiler::SceneGraphFrame:
85 switch (decodedDetailType) {
87 case QQuickProfiler::SceneGraphRendererFrame: ds << data.subtime_1 << data.subtime_2 << data.subtime_3 << data.subtime_4;
break;
89 case QQuickProfiler::SceneGraphAdaptationLayerFrame: ds << data.subtime_3 << data.subtime_1 << data.subtime_2;
break;
91 case QQuickProfiler::SceneGraphContextFrame: ds << data.subtime_1;
break;
93 case QQuickProfiler::SceneGraphRenderLoopFrame: ds << data.subtime_1 << data.subtime_2 << data.subtime_3;
break;
95 case QQuickProfiler::SceneGraphTexturePrepare: ds << data.subtime_1 << data.subtime_2 << data.subtime_3 << data.subtime_4 << data.subtime_5;
break;
97 case QQuickProfiler::SceneGraphTextureDeletion: ds << data.subtime_1;
break;
99 case QQuickProfiler::SceneGraphPolishAndSync: ds << data.subtime_1 << data.subtime_2 << data.subtime_3 << data.subtime_4;
break;
101 case QQuickProfiler::SceneGraphWindowsRenderShow: ds << data.subtime_1 << data.subtime_2 << data.subtime_3;
break;
103 case QQuickProfiler::SceneGraphWindowsAnimations: ds << data.subtime_1;
break;
105 case QQuickProfiler::SceneGraphPolishFrame: ds << data.subtime_1;
break;
110 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Invalid message type.");
113 messages.append(ds.squeezedData());