diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index 2654cf662b..a5ee494ced 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -407,20 +407,24 @@ void QQmlProfilerServiceImpl::messageReceived(const QByteArray &message) void QQmlProfilerServiceImpl::flush() { QMutexLocker lock(&m_configMutex); + QList reporting; foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers) { if (profiler->isRunning()) { m_startTimes.insert(-1, profiler); - profiler->reportData(); + reporting.append(profiler); } } foreach (QQmlAbstractProfilerAdapter *profiler, m_globalProfilers) { if (profiler->isRunning()) { m_startTimes.insert(-1, profiler); - profiler->reportData(); + reporting.append(profiler); } } + + foreach (QQmlAbstractProfilerAdapter *profiler, reporting) + profiler->reportData(); } QT_END_NAMESPACE diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 0e63e18952..670d58e4fd 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -135,7 +135,7 @@ public: }; QQmlProfilerClient(QQmlDebugConnection *connection) - : QQmlDebugClient(QLatin1String("CanvasFrameRate"), connection) + : QQmlDebugClient(QLatin1String("CanvasFrameRate"), connection), lastTimestamp(-1) { } @@ -145,6 +145,8 @@ public: QVector asynchronousMessages; QVector pixmapMessages; + qint64 lastTimestamp; + void setTraceState(bool enabled, quint32 flushInterval = 0) { QByteArray message; QDataStream stream(&message, QIODevice::WriteOnly); @@ -343,6 +345,10 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message) break; } QVERIFY(stream.atEnd()); + + QVERIFY(data.time >= lastTimestamp); + lastTimestamp = data.time; + if (data.messageType == QQmlProfilerClient::PixmapCacheEvent) pixmapMessages.append(data); else if (data.messageType == QQmlProfilerClient::SceneGraphFrame ||