aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-07-28 13:22:33 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-04 13:34:22 +0000
commit4e6de08ba154e541587b2939137a3da1081750be (patch)
tree7e5f85abcdabdb3b560fe5b4fd4b38c8d20c73d3 /tests
parente77e9dc2c32edd0f7c437df48fc40c9b6a2a03cc (diff)
Periodically flush profiling data to client.
This reduces memory usage as the data can be deleted once it is sent. It also reduces the time it takes to transmit the data when profiling is stopped. It does incur a runtime cost as the sending now takes place while the application is running. The decision to periodically flush or not is left to the client, who can specify a flush interval when starting profiling. Usage of the flushing feature also relaxes the guarantees regarding the sorting of events before they are sent. Events with higher timestamps are now allowed to arrive before events with lower timestamps. Any clients implementing the flushing need to take this into account. This will eventually allow us to do away with the server-side ordering altogether. Task-number: QTBUG-39756 Change-Id: Idaf4931dc17f224c2bd492078b99e88b1405234e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml14
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro3
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp23
3 files changed, 38 insertions, 2 deletions
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml
new file mode 100644
index 0000000000..18b8947172
--- /dev/null
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.0
+
+Rectangle {
+ width: 100
+ height: 62
+
+ Timer {
+ running: true
+ repeat: true
+ interval: 50
+ onTriggered: height = (2 * height) % 99;
+ }
+}
+
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index ec84139797..e422d3ef99 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -21,4 +21,5 @@ OTHER_FILES += \
data/scenegraphTest.qml \
data/TestImage_2x2.png \
data/signalSourceLocation.qml \
- data/javascript.qml
+ data/javascript.qml \
+ data/timer.qml
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index f9f05964a7..744830b55b 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -145,10 +145,12 @@ public:
QVector<QQmlProfilerData> asynchronousMessages;
QVector<QQmlProfilerData> pixmapMessages;
- void setTraceState(bool enabled) {
+ void setTraceState(bool enabled, quint32 flushInterval = 0) {
QByteArray message;
QDataStream stream(&message, QIODevice::WriteOnly);
stream << enabled;
+ if (enabled && flushInterval)
+ stream << -1 << std::numeric_limits<quint64>::max() << flushInterval;
sendMessage(message);
}
@@ -213,6 +215,7 @@ private slots:
void controlFromJS();
void signalSourceLocation();
void javascript();
+ void flushInterval();
};
#define VERIFY(type, position, expected, checks) QVERIFY(verify(type, position, expected, checks))
@@ -766,6 +769,24 @@ void tst_QQmlProfilerService::javascript()
VERIFY(MessageListJavaScript, 21, expected, CheckMessageType | CheckDetailType);
}
+void tst_QQmlProfilerService::flushInterval()
+{
+ connect(true, "timer.qml");
+ QVERIFY(m_client);
+ QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled);
+
+ m_client->setTraceState(true, 1);
+
+ // Make sure we get multiple messages
+ QTRY_VERIFY(m_client->qmlMessages.length() > 0);
+ QVERIFY(m_client->qmlMessages.length() < 100);
+ QTRY_VERIFY(m_client->qmlMessages.length() > 100);
+
+ m_client->setTraceState(false);
+ checkTraceReceived();
+ checkJsHeap();
+}
+
QTEST_MAIN(tst_QQmlProfilerService)
#include "tst_qqmlprofilerservice.moc"