diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-01-15 12:28:09 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-01-16 09:56:33 +0000 |
commit | 228790f27a4cb8f4f307693fb1c9f13a96eddfaa (patch) | |
tree | 4fdba03ed3423926e60fa7dcd1e1cd3aa7f03eab /src/plugins | |
parent | 52874a0e6f739ce410c8401e19b0a9ef6d02cabf (diff) |
QQmlProfilerService: Only send "Complete" if no more engines are running
Also, make sure to report all engine's events when stopping one.
Otherwise the timestamps will reset when reporting multiple engines in a
row (such as when stopping the application).
Task-number: QTBUG-65767
Change-Id: I0a6a9170069318dd5b8a7422cb7e248c87d5adce
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp | 32 |
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) |