From d53b07ee19ee940672b1bcd8e692a488f3b6eb4e Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 23 Nov 2017 10:05:30 +0100 Subject: Re-enable QML memory profiling Task-number: QTBUG-64674 Change-Id: I48ed1a51f66ef8d55cc026f140d270baaca04fbf Reviewed-by: Lars Knoll --- .../debugger/qqmlprofilerservice/data/memory.qml | 17 +++++++++++++++++ .../qqmlprofilerservice/qqmlprofilerservice.pro | 3 ++- .../qqmlprofilerservice/tst_qqmlprofilerservice.cpp | 21 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/auto/qml/debugger/qqmlprofilerservice/data/memory.qml (limited to 'tests') diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/memory.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/memory.qml new file mode 100644 index 0000000000..f39dcdf16a --- /dev/null +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/memory.qml @@ -0,0 +1,17 @@ +import QtQml 2.0 + +Timer { + interval: 1 + running: true + + function recurse(i) { + var x = { t: [1, 2, 3, 4] } + console.log(x.t[i]); + if (i < 3) + recurse(i + 1); + else + Qt.quit(); + } + + onTriggered: recurse(0) +} diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index f5e3dbdc2f..56840d5c8f 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -21,4 +21,5 @@ OTHER_FILES += \ data/TestImage_2x2.png \ data/signalSourceLocation.qml \ data/javascript.qml \ - data/timer.qml + data/timer.qml \ + data/memory.qml diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index b8e1f1f21d..bc6c51707a 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -312,6 +312,7 @@ private slots: void signalSourceLocation(); void javascript(); void flushInterval(); + void memory(); }; #define VERIFY(type, position, expected, checks) QVERIFY(verify(type, position, expected, checks)) @@ -756,6 +757,26 @@ void tst_QQmlProfilerService::flushInterval() checkJsHeap(); } +void tst_QQmlProfilerService::memory() +{ + connect(true, "memory.qml"); + if (QTest::currentTestFailed() || QTestResult::skipCurrentTest()) + return; + + m_client->sendRecordingStatus(true); + + checkTraceReceived(); + checkJsHeap(); + + int smallItems = 0; + for (auto message : m_client->jsHeapMessages) { + if (message.detailType == QV4::Profiling::SmallItem) + ++smallItems; + } + + QVERIFY(smallItems > 5); +} + QTEST_MAIN(tst_QQmlProfilerService) #include "tst_qqmlprofilerservice.moc" -- cgit v1.2.3