From 3e81e44d7595bb0063de0d3453463363cb2972eb Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 5 Mar 2019 02:04:45 +0100 Subject: [PATCH] Separate processing for allocated callstacks. Only native callstack is used for the moment. --- server/TracyWorker.cpp | 35 ++++++++++++++++++++++++++++++++++- server/TracyWorker.hpp | 1 + 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 06f42080..0a2447d5 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -2410,9 +2410,11 @@ bool Worker::Process( const QueueItem& ev ) ProcessCallstackMemory( ev.callstackMemory ); break; case QueueType::Callstack: - case QueueType::CallstackAlloc: ProcessCallstack( ev.callstack ); break; + case QueueType::CallstackAlloc: + ProcessCallstackAlloc( ev.callstackAlloc ); + break; case QueueType::CallstackFrameSize: ProcessCallstackFrameSize( ev.callstackFrameSize ); break; @@ -3209,6 +3211,37 @@ void Worker::ProcessCallstack( const QueueCallstack& ev ) m_pendingCallstacks.erase( it ); } +void Worker::ProcessCallstackAlloc( const QueueCallstackAlloc& ev ) +{ + auto it = m_pendingCallstacks.find( ev.nativePtr ); + assert( it != m_pendingCallstacks.end() ); + auto itAlloc = m_pendingCallstacks.find( ev.ptr ); + assert( itAlloc != m_pendingCallstacks.end() ); + + auto nit = m_nextCallstack.find( ev.thread ); + assert( nit != m_nextCallstack.end() ); + auto& next = nit->second; + + switch( next.type ) + { + case NextCallstackType::Zone: + next.zone->callstack = it->second; + break; + case NextCallstackType::Gpu: + next.gpu->callstack = it->second; + break; + case NextCallstackType::Crash: + m_data.m_crashEvent.callstack = it->second; + break; + default: + assert( false ); + break; + } + + m_pendingCallstacks.erase( it ); + m_pendingCallstacks.erase( itAlloc ); +} + void Worker::ProcessCallstackFrameSize( const QueueCallstackFrameSize& ev ) { assert( !m_callstackFrameStaging ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index b57a9c30..5f3437b5 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -382,6 +382,7 @@ private: tracy_force_inline void ProcessMemFreeCallstack( const QueueMemFree& ev ); tracy_force_inline void ProcessCallstackMemory( const QueueCallstackMemory& ev ); tracy_force_inline void ProcessCallstack( const QueueCallstack& ev ); + tracy_force_inline void ProcessCallstackAlloc( const QueueCallstackAlloc& ev ); tracy_force_inline void ProcessCallstackFrameSize( const QueueCallstackFrameSize& ev ); tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev ); tracy_force_inline void ProcessCrashReport( const QueueCrashReport& ev );