aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickprofiler.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-09-16 13:23:19 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-10-15 08:23:15 +0000
commit2f03049d4cabfac822bcf6b5886b078d70064968 (patch)
treee79c7cdc5e300d8889d0525d0a3b1f5582921aa1 /src/quick/util/qquickprofiler.cpp
parent1a123472ba0e56d1fd772db430e6d4532f672a6e (diff)
Put QPacketProtocol into its own static library
We need it in 3 places in qtdeclarative and we could also use it in QtCreator. We don't want to bundle it with the debug client code as it is also necessary for the server. QPacket replaces QQmlDebugStream as it has the same purpose. This also fixes the inconsitent handling of data stream versions. Change-Id: I650fae353f267511c551b427d9169f4d718aa7f2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/quick/util/qquickprofiler.cpp')
-rw-r--r--src/quick/util/qquickprofiler.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/quick/util/qquickprofiler.cpp b/src/quick/util/qquickprofiler.cpp
index 77ffda474a..44fdbc5da8 100644
--- a/src/quick/util/qquickprofiler.cpp
+++ b/src/quick/util/qquickprofiler.cpp
@@ -34,6 +34,7 @@
#include "qquickprofiler_p.h"
#include <QCoreApplication>
#include <private/qqmldebugserviceinterfaces_p.h>
+#include <private/qpacket_p.h>
QT_BEGIN_NAMESPACE
@@ -46,7 +47,6 @@ quint64 QQuickProfiler::featuresEnabled = 0;
// (see tst_qqmldebugtrace::trace() benchmark)
void QQuickProfilerData::toByteArrays(QList<QByteArray> &messages) const
{
- QByteArray data;
Q_ASSERT_X(((messageType | detailType) & (1 << 31)) == 0, Q_FUNC_INFO, "You can use at most 31 message types and 31 detail types.");
for (uint decodedMessageType = 0; (messageType >> decodedMessageType) != 0; ++decodedMessageType) {
if ((messageType & (1 << decodedMessageType)) == 0)
@@ -57,7 +57,7 @@ void QQuickProfilerData::toByteArrays(QList<QByteArray> &messages) const
continue;
//### using QDataStream is relatively expensive
- QQmlDebugStream ds(&data, QIODevice::WriteOnly);
+ QPacket ds;
ds << time << decodedMessageType << decodedDetailType;
switch (decodedMessageType) {
@@ -103,8 +103,7 @@ void QQuickProfilerData::toByteArrays(QList<QByteArray> &messages) const
Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid message type.");
break;
}
- messages << data;
- data.clear();
+ messages << ds.data();
}
}
}