diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-03-03 11:25:27 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-03-11 09:18:58 +0000 |
commit | 9ca9de7cbc8b045c19899987d6666576399af33d (patch) | |
tree | 43edf7e25ffb0fba2578db47bf5c0175fea76ced /src/qmldebug | |
parent | d87572053a15474a577dcf5714187fbdb4cfec0d (diff) |
QmlDebug: Support sending multiple messages per packet
This reduces the overhead caused by the prepending of service names to
packets. When running the planets example from qtcanvas3d through
qmlprofiler the average message length, without service name, is 26
bytes. The average full packet, with name and length, is 64 bytes long.
In fact, the time between stopping the application and the last message
arriving in the profiling client is reduced by 30-50% with this
change.
Change-Id: I0ffdd0483d45bbe8b092c59a9dcd63c6dc59119c
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qmldebug')
-rw-r--r-- | src/qmldebug/qqmldebugconnection.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/qmldebug/qqmldebugconnection.cpp b/src/qmldebug/qqmldebugconnection.cpp index 37b66889cd..35a540bff8 100644 --- a/src/qmldebug/qqmldebugconnection.cpp +++ b/src/qmldebug/qqmldebugconnection.cpp @@ -106,7 +106,8 @@ void QQmlDebugConnection::socketConnected() { Q_D(QQmlDebugConnection); QPacket pack(d->currentDataStreamVersion); - pack << serverId << 0 << protocolVersion << d->plugins.keys() << d->maximumDataStreamVersion; + pack << serverId << 0 << protocolVersion << d->plugins.keys() << d->maximumDataStreamVersion + << true; // We accept multiple messages per packet d->protocol->send(pack.data()); d->flush(); } @@ -221,9 +222,6 @@ void QQmlDebugConnection::protocolReadyRead() qWarning() << "QQmlDebugConnection: Unknown control message id" << op; } } else { - QByteArray message; - pack >> message; - QHash<QString, QQmlDebugClient *>::Iterator iter = d->plugins.find(name); if (iter == d->plugins.end()) { // We can get more messages for plugins we have removed because it takes time to @@ -232,7 +230,12 @@ void QQmlDebugConnection::protocolReadyRead() qWarning() << "QQmlDebugConnection: Message received for missing plugin" << name; } else { - (*iter)->messageReceived(message); + QQmlDebugClient *client = *iter; + QByteArray message; + while (!pack.atEnd()) { + pack >> message; + client->messageReceived(message); + } } } } |