QmlProfiler: When flushing data, send it in the right order
Some of the adapters immediately return dataReady() when reportData() is invoked. This means that there is only one adapter in the start times list then, which in turn causes all the data from that adapter to be sent at once, without caring for the other adapters' timestamps. Change-Id: Ic1e12fdcefb0a691067518fba100368f13c927f7 Task-number: QTBUG-53590 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
3b2a72068f
commit
0e05352843
|
@ -407,20 +407,24 @@ void QQmlProfilerServiceImpl::messageReceived(const QByteArray &message)
|
|||
void QQmlProfilerServiceImpl::flush()
|
||||
{
|
||||
QMutexLocker lock(&m_configMutex);
|
||||
QList<QQmlAbstractProfilerAdapter *> 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
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
};
|
||||
|
||||
QQmlProfilerClient(QQmlDebugConnection *connection)
|
||||
: QQmlDebugClient(QLatin1String("CanvasFrameRate"), connection)
|
||||
: QQmlDebugClient(QLatin1String("CanvasFrameRate"), connection), lastTimestamp(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,8 @@ public:
|
|||
QVector<QQmlProfilerData> asynchronousMessages;
|
||||
QVector<QQmlProfilerData> 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 ||
|
||||
|
|
Loading…
Reference in New Issue