diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-24 11:58:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-27 09:31:08 +0000 |
commit | 515efdb8a65dc8ba22a56a02ee6d7056f39619cb (patch) | |
tree | d984f8725ca2e9b0663b33378e5fe1d13b64fa8e /src/qmldebug | |
parent | 777aac3005feb01aed21df9e135d5470182bc6ce (diff) |
QmlProfiler: Send RangeData and RangeLocation only once per type
This saves time when serializing the data to be sent.
Change-Id: Ic8c534d55445934a64dd253273099194b27d98af
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qmldebug')
-rw-r--r-- | src/qmldebug/qqmlprofilerclient.cpp | 21 | ||||
-rw-r--r-- | src/qmldebug/qqmlprofilerclient_p_p.h | 8 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/qmldebug/qqmlprofilerclient.cpp b/src/qmldebug/qqmlprofilerclient.cpp index 6f6b04ade9..29ccbb33b6 100644 --- a/src/qmldebug/qqmlprofilerclient.cpp +++ b/src/qmldebug/qqmlprofilerclient.cpp @@ -70,7 +70,7 @@ void QQmlProfilerClient::sendRecordingStatus(bool record, int engineId, quint32 Q_D(const QQmlProfilerClient); QPacket stream(d->connection->currentDataStreamVersion()); - stream << record << engineId << d->features << flushInterval; + stream << record << engineId << d->features << flushInterval << true; sendMessage(stream.data()); } @@ -205,7 +205,7 @@ inline QQmlProfilerDefinitions::ProfileFeature featureFromRangeType( void QQmlProfilerClient::messageReceived(const QByteArray &data) { - Q_D(const QQmlProfilerClient); + Q_D(QQmlProfilerClient); QPacket stream(d->connection->currentDataStreamVersion(), data); @@ -333,12 +333,25 @@ void QQmlProfilerClient::messageReceived(const QByteArray &data) !(d->features & one << featureFromRangeType(rangeType))) return; + qint64 typeId = 0; if (messageType == QQmlProfilerDefinitions::RangeStart) { rangeStart(rangeType, time); + if (!stream.atEnd()) { + stream >> typeId; + auto i = d->types.constFind(typeId); + if (i != d->types.constEnd()) { + rangeLocation(rangeType, time, i->location); + rangeData(rangeType, time, i->name); + } + } } else if (messageType == QQmlProfilerDefinitions::RangeData) { QString data; stream >> data; rangeData(rangeType, time, data); + if (!stream.atEnd()) { + stream >> typeId; + d->types[typeId].name = data; + } } else if (messageType == QQmlProfilerDefinitions::RangeLocation) { QQmlEventLocation location; stream >> location.filename >> location.line; @@ -347,6 +360,10 @@ void QQmlProfilerClient::messageReceived(const QByteArray &data) stream >> location.column; rangeLocation(rangeType, time, location); + if (!stream.atEnd()) { + stream >> typeId; + d->types[typeId].location = location; + } } else if (messageType == QQmlProfilerDefinitions::RangeEnd) { rangeEnd(rangeType, time); } else { diff --git a/src/qmldebug/qqmlprofilerclient_p_p.h b/src/qmldebug/qqmlprofilerclient_p_p.h index 8238c97dd8..9c44113aa8 100644 --- a/src/qmldebug/qqmlprofilerclient_p_p.h +++ b/src/qmldebug/qqmlprofilerclient_p_p.h @@ -56,12 +56,20 @@ QT_BEGIN_NAMESPACE +struct QQmlProfilerRangeType +{ + QQmlEventLocation location; + QString name; +}; + class QQmlProfilerClientPrivate : public QQmlDebugClientPrivate { Q_DECLARE_PUBLIC(QQmlProfilerClient) public: QQmlProfilerClientPrivate(QQmlDebugConnection *connection); quint64 features; + + QHash<qint64, QQmlProfilerRangeType> types; }; QT_END_NAMESPACE |