From 79128071337e8a533cee2b190c637f598871fb3f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 20 Jun 2018 14:57:48 +0200 Subject: [PATCH] Wait for transfer of pending callback frames. --- server/TracyWorker.cpp | 7 ++++++- server/TracyWorker.hpp | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 947b786f..9f5fb910 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -187,6 +187,7 @@ Worker::Worker( const char* addr ) , m_pendingStrings( 0 ) , m_pendingThreads( 0 ) , m_pendingSourceLocation( 0 ) + , m_pendingCallbackFrames( 0 ) { m_data.sourceLocationExpand.push_back( 0 ); m_data.threadExpand.push_back( 0 ); @@ -995,7 +996,7 @@ void Worker::Exec() if( m_terminate ) { - if( m_pendingStrings != 0 || m_pendingThreads != 0 || m_pendingSourceLocation != 0 || + if( m_pendingStrings != 0 || m_pendingThreads != 0 || m_pendingSourceLocation != 0 || m_pendingCallbackFrames != 0 || !m_pendingCustomStrings.empty() || !m_pendingPlots.empty() || !m_pendingCallstacks.empty() ) { continue; @@ -1365,6 +1366,7 @@ void Worker::AddCallstackPayload( uint64_t ptr, char* _data, size_t sz ) auto fit = m_data.callstackFrameMap.find( frame ); if( fit == m_data.callstackFrameMap.end() ) { + m_pendingCallbackFrames++; ServerQuery( ServerQueryCallstackFrame, frame ); } } @@ -2128,6 +2130,9 @@ void Worker::ProcessCallstackMemory( const QueueCallstackMemory& ev ) void Worker::ProcessCallstackFrame( const QueueCallstackFrame& ev ) { + assert( m_pendingCallbackFrames > 0 ); + m_pendingCallbackFrames--; + auto fmit = m_data.callstackFrameMap.find( ev.ptr ); auto nit = m_pendingCustomStrings.find( ev.name ); assert( nit != m_pendingCustomStrings.end() ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index d3e46dc6..883c19ff 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -310,6 +310,7 @@ private: uint32_t m_pendingStrings; uint32_t m_pendingThreads; uint32_t m_pendingSourceLocation; + uint32_t m_pendingCallbackFrames; uint64_t m_lastMemActionCallstack; bool m_lastMemActionWasAlloc;