17QQuickProfilerAdapter::QQuickProfilerAdapter(QObject *parent) :
18 QQmlAbstractProfilerAdapter(parent), next(0)
20 QQuickProfiler::initialize(
this);
23 connect(
this, &QQmlAbstractProfilerAdapter::profilingEnabled,
24 QQuickProfiler::s_instance, &QQuickProfiler::startProfilingImpl, Qt::DirectConnection);
25 connect(
this, &QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting,
26 QQuickProfiler::s_instance, &QQuickProfiler::startProfilingImpl, Qt::DirectConnection);
27 connect(
this, &QQmlAbstractProfilerAdapter::referenceTimeKnown,
28 QQuickProfiler::s_instance, &QQuickProfiler::setTimer, Qt::DirectConnection);
29 connect(
this, &QQmlAbstractProfilerAdapter::profilingDisabled,
30 QQuickProfiler::s_instance, &QQuickProfiler::stopProfilingImpl, Qt::DirectConnection);
31 connect(
this, &QQmlAbstractProfilerAdapter::profilingDisabledWhileWaiting,
32 QQuickProfiler::s_instance, &QQuickProfiler::stopProfilingImpl, Qt::DirectConnection);
33 connect(
this, &QQmlAbstractProfilerAdapter::dataRequested,
34 QQuickProfiler::s_instance, &QQuickProfiler::reportDataImpl, Qt::DirectConnection);
35 connect(QQuickProfiler::s_instance, &QQuickProfiler::dataReady,
36 this, &QQuickProfilerAdapter::receiveData, Qt::DirectConnection);
47 QList<QByteArray> &messages)
50 Q_ASSERT_X(((data.messageType | data.detailType) & (1 << 31)) == 0, Q_FUNC_INFO,
51 "You can use at most 31 message types and 31 detail types.");
52 for (uint decodedMessageType = 0; (data.messageType >> decodedMessageType) != 0;
53 ++decodedMessageType) {
54 if ((data.messageType & (1 << decodedMessageType)) == 0)
57 for (uint decodedDetailType = 0; (data.detailType >> decodedDetailType) != 0;
58 ++decodedDetailType) {
59 if ((data.detailType & (1 << decodedDetailType)) == 0)
62 ds << data.time << decodedMessageType << decodedDetailType;
64 switch (decodedMessageType) {
65 case QQuickProfiler::Event:
66 switch (decodedDetailType) {
67 case QQuickProfiler::AnimationFrame:
68 ds << data.framerate << data.count << data.threadId;
70 case QQuickProfiler::Key:
71 case QQuickProfiler::Mouse:
72 ds << data.inputType << data.inputA << data.inputB;
76 case QQuickProfiler::PixmapCacheEvent:
77 ds << data.detailUrl.toString();
78 switch (decodedDetailType) {
79 case QQuickProfiler::PixmapSizeKnown: ds << data.x << data.y;
break;
80 case QQuickProfiler::PixmapReferenceCountChanged: ds << data.count;
break;
81 case QQuickProfiler::PixmapCacheCountChanged: ds << data.count;
break;
85 case QQuickProfiler::SceneGraphFrame:
86 switch (decodedDetailType) {
88 case QQuickProfiler::SceneGraphRendererFrame: ds << data.subtime_1 << data.subtime_2 << data.subtime_3 << data.subtime_4;
break;
90 case QQuickProfiler::SceneGraphAdaptationLayerFrame: ds << data.subtime_3 << data.subtime_1 << data.subtime_2;
break;
92 case QQuickProfiler::SceneGraphContextFrame: ds << data.subtime_1;
break;
94 case QQuickProfiler::SceneGraphRenderLoopFrame: ds << data.subtime_1 << data.subtime_2 << data.subtime_3;
break;
96 case QQuickProfiler::SceneGraphTexturePrepare: ds << data.subtime_1 << data.subtime_2 << data.subtime_3 << data.subtime_4 << data.subtime_5;
break;
98 case QQuickProfiler::SceneGraphTextureDeletion: ds << data.subtime_1;
break;
100 case QQuickProfiler::SceneGraphPolishAndSync: ds << data.subtime_1 << data.subtime_2 << data.subtime_3 << data.subtime_4;
break;
102 case QQuickProfiler::SceneGraphWindowsRenderShow: ds << data.subtime_1 << data.subtime_2 << data.subtime_3;
break;
104 case QQuickProfiler::SceneGraphWindowsAnimations: ds << data.subtime_1;
break;
106 case QQuickProfiler::SceneGraphPolishFrame: ds << data.subtime_1;
break;
111 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Invalid message type.");
114 messages.append(ds.squeezedData());