diff options
author | Mikko Harju <mikko.a.harju@nokia.com> | 2011-12-08 13:24:12 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-12 02:04:53 +0100 |
commit | 18ce33ecd994666d42e438c4aa62302c72465458 (patch) | |
tree | cda4a43bc5721e9c0b0916b46ca10df1ea63d0a0 /tests/auto/declarative/debugger | |
parent | d0dc58b8c300682b92fa018e04193ffccd79ef15 (diff) |
QmlProfiler: stream snapshots to reduce memory footprint
Taking a V8 heap snapshot with QV8ProfilerService created multiple
copies of the snapshot data, causing overhead of several megabytes.
This patch changes the snapshot protocol to stream the contents over
the debugger connection.
Change-Id: I90054210233d52dd02aa838201f9b024d578fcea
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'tests/auto/declarative/debugger')
-rw-r--r-- | tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp index 0739c746b9..46c587da83 100644 --- a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp +++ b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp @@ -88,9 +88,11 @@ public: } QList<QV8ProfilerData> traceMessages; + QList<QByteArray> snapshotMessages; signals: void complete(); + void snapshot(); protected: void messageReceived(const QByteArray &message); @@ -121,6 +123,7 @@ private slots: void blockingConnectWithTraceEnabled(); void blockingConnectWithTraceDisabled(); void nonBlockingConnect(); + void snapshot(); }; void QV8ProfilerClient::messageReceived(const QByteArray &message) @@ -144,7 +147,14 @@ void QV8ProfilerClient::messageReceived(const QByteArray &message) case QV8ProfilerService::V8Complete: emit complete(); break; - case QV8ProfilerService::V8Snapshot: + case QV8ProfilerService::V8SnapshotChunk: { + QByteArray json; + stream >> json; + snapshotMessages.append(json); + break; + } + case QV8ProfilerService::V8SnapshotComplete: + emit snapshot(); break; default: QString failMessage = QString("Unknown message type: %1").arg(messageType); @@ -230,6 +240,19 @@ void tst_QV8ProfilerService::nonBlockingConnect() } } +void tst_QV8ProfilerService::snapshot() +{ + connect(false); + QTRY_COMPARE(m_client->status(), QDeclarativeDebugClient::Enabled); + + m_client->takeSnapshot(); + if (!QDeclarativeDebugTest::waitForSignal(m_client, SIGNAL(snapshot()))) { + QString failMsg + = QString("No snapshot received in time. App output: %1\n\n").arg(m_process->output()); + QFAIL(qPrintable(failMsg)); + } +} + QTEST_MAIN(tst_QV8ProfilerService) #include "tst_qv8profilerservice.moc" |