From ad3aa730851c21c3c0aac207a13589175c9601e8 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 10 Feb 2020 22:29:54 +0100 Subject: [PATCH] Change order of background tasks. Now tasks are performed in the following order: - Context switch based CPU usage graph. - Memory allocations plot. - Zone statistics. This prioritizes appearance of the most notable things first. --- server/TracyWorker.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index c32efb1c..68ecc840 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -1591,6 +1591,18 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) m_backgroundDone.store( false, std::memory_order_relaxed ); #ifndef TRACY_NO_STATISTICS m_threadBackground = std::thread( [this, reconstructMemAllocPlot] { + if( !m_data.ctxSwitch.empty() ) + { + ReconstructContextSwitchUsage(); + if( m_shutdown.load( std::memory_order_relaxed ) ) return; + } + + if( reconstructMemAllocPlot ) + { + ReconstructMemAllocPlot(); + if( m_shutdown.load( std::memory_order_relaxed ) ) return; + } + std::function>&, uint16_t)> ProcessTimeline; ProcessTimeline = [this, &ProcessTimeline] ( Vector>& _vec, uint16_t thread ) { @@ -1627,10 +1639,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks ) std::lock_guard lock( m_data.lock ); m_data.sourceLocationZonesReady = true; } - if( m_shutdown.load( std::memory_order_relaxed ) ) return; - if( !m_data.ctxSwitch.empty() ) ReconstructContextSwitchUsage(); - if( m_shutdown.load( std::memory_order_relaxed ) ) return; - if( reconstructMemAllocPlot ) ReconstructMemAllocPlot(); + m_backgroundDone.store( true, std::memory_order_relaxed ); } ); #else