aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp')
-rw-r--r--src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
index 4176ede40e..affd2a417e 100644
--- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp
@@ -296,10 +296,11 @@ void QQmlProfilerServiceImpl::stopProfiling(QJSEngine *engine)
for (QMultiHash<QJSEngine *, QQmlAbstractProfilerAdapter *>::iterator i(m_engineProfilers.begin());
i != m_engineProfilers.end(); ++i) {
if (i.value()->isRunning()) {
+ m_startTimes.insert(-1, i.value());
if (engine == 0 || i.key() == engine) {
- m_startTimes.insert(-1, i.value());
stopping << i.value();
} else {
+ reporting << i.value();
stillRunning = true;
}
}
@@ -368,25 +369,32 @@ void QQmlProfilerServiceImpl::sendMessages()
}
}
+ bool stillRunning = false;
+ for (const QQmlAbstractProfilerAdapter *profiler : qAsConst(m_engineProfilers)) {
+ if (profiler->isRunning()) {
+ stillRunning = true;
+ break;
+ }
+ }
+
if (m_waitingForStop) {
- //indicate completion
+ // EndTrace can be sent multiple times, as it's engine specific.
messages << traceEnd.data();
- QQmlDebugPacket ds;
- ds << (qint64)-1 << (int)Complete;
- messages << ds.data();
- m_waitingForStop = false;
+ if (!stillRunning) {
+ // Complete is only sent once, when no engines are running anymore.
+ QQmlDebugPacket ds;
+ ds << (qint64)-1 << (int)Complete;
+ messages << ds.data();
+ m_waitingForStop = false;
+ }
}
emit messagesToClient(name(), messages);
// Restart flushing if any profilers are still running
- for (const QQmlAbstractProfilerAdapter *profiler : qAsConst(m_engineProfilers)) {
- if (profiler->isRunning()) {
- emit startFlushTimer();
- break;
- }
- }
+ if (stillRunning)
+ emit startFlushTimer();
}
void QQmlProfilerServiceImpl::stateAboutToBeChanged(QQmlDebugService::State newState)