aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2016-03-02 16:26:36 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2016-03-11 09:18:54 +0000
commitd87572053a15474a577dcf5714187fbdb4cfec0d (patch)
tree7bfdaa1bc40d2c201881db44b0d9a68888f4f52c /src/plugins
parentc44413067da24f5d768f3fde25248cdba5a566bd (diff)
QmlProfiler: Send events in smaller batches
This enables more parallel data processing and limits the memory usage. Benchmarks with the "planets" example from canvas3d show that this change reduces the time between the profiling being stopped and the last events arriving in the profiling client by about 50%. Change-Id: Iea16f9e2ae3adf584ec4a3c7fc766eaa21740f98 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp15
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp4
-rw-r--r--src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp2
4 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp
index e89d87e76b..872dcbe718 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp
@@ -107,7 +107,7 @@ static void qQmlProfilerDataToByteArrays(const QQmlProfilerData *d, QList<QByteA
qint64 QQmlProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &messages)
{
while (next != data.length()) {
- if (data[next].time > until)
+ if (data[next].time > until || messages.length() > s_numMessagesPerBatch)
return data[next].time;
qQmlProfilerDataToByteArrays(&(data[next++]), messages);
}
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
index fc2ba1e094..9e1c8af3e6 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
@@ -342,12 +342,15 @@ void QQmlProfilerServiceImpl::sendMessages()
while (!m_startTimes.empty()) {
QQmlAbstractProfilerAdapter *first = m_startTimes.begin().value();
m_startTimes.erase(m_startTimes.begin());
- if (!m_startTimes.empty()) {
- qint64 next = first->sendMessages(m_startTimes.begin().key(), messages);
- if (next != -1)
- m_startTimes.insert(next, first);
- } else {
- first->sendMessages(std::numeric_limits<qint64>::max(), messages);
+ qint64 next = first->sendMessages(m_startTimes.isEmpty() ?
+ std::numeric_limits<qint64>::max() :
+ m_startTimes.begin().key(), messages);
+ if (next != -1)
+ m_startTimes.insert(next, first);
+
+ if (messages.length() >= QQmlAbstractProfilerAdapter::s_numMessagesPerBatch) {
+ emit messagesToClient(name(), messages);
+ messages.clear();
}
}
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp
index ffacc58817..e91f7fbf51 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp
+++ b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.cpp
@@ -105,7 +105,7 @@ qint64 QV4ProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &message
while (!m_stack.isEmpty() &&
(m_functionCallPos == m_functionCallData.length() ||
m_stack.top() <= m_functionCallData[m_functionCallPos].start)) {
- if (m_stack.top() > until)
+ if (m_stack.top() > until || messages.length() > s_numMessagesPerBatch)
return finalizeMessages(until, messages, m_stack.top());
appendMemoryEvents(m_stack.top(), messages);
@@ -117,7 +117,7 @@ qint64 QV4ProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &message
(m_stack.empty() || m_functionCallData[m_functionCallPos].start < m_stack.top())) {
const QV4::Profiling::FunctionCallProperties &props =
m_functionCallData[m_functionCallPos];
- if (props.start > until)
+ if (props.start > until || messages.length() > s_numMessagesPerBatch)
return finalizeMessages(until, messages, props.start);
appendMemoryEvents(props.start, messages);
diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp
index 5ca64fda15..0f44ba3dc2 100644
--- a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp
+++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp
@@ -153,7 +153,7 @@ static void qQuickProfilerDataToByteArrays(const QQuickProfilerData &data,
qint64 QQuickProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &messages)
{
while (next < m_data.size()) {
- if (m_data[next].time <= until)
+ if (m_data[next].time <= until && messages.length() <= s_numMessagesPerBatch)
qQuickProfilerDataToByteArrays(m_data[next++], messages);
else
return m_data[next].time;