diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index eb490c18..dc3ac5c2 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -1495,6 +1495,9 @@ void Worker::Process( const QueueItem& ev ) case QueueType::ZoneBegin: ProcessZoneBegin( ev.zoneBegin ); break; + case QueueType::ZoneBeginCallstack: + ProcessZoneBeginCallstack( ev.zoneBegin ); + break; case QueueType::ZoneBeginAllocSrcLoc: ProcessZoneBeginAllocSrcLoc( ev.zoneBegin ); break; @@ -1585,10 +1588,8 @@ void Worker::Process( const QueueItem& ev ) } } -void Worker::ProcessZoneBegin( const QueueZoneBegin& ev ) +void Worker::ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev ) { - auto zone = m_slab.AllocInit(); - CheckSourceLocation( ev.srcloc ); zone->start = TscTime( ev.time ); @@ -1602,6 +1603,22 @@ void Worker::ProcessZoneBegin( const QueueZoneBegin& ev ) NewZone( zone, ev.thread ); } +void Worker::ProcessZoneBegin( const QueueZoneBegin& ev ) +{ + auto zone = m_slab.AllocInit(); + ProcessZoneBeginImpl( zone, ev ); +} + +void Worker::ProcessZoneBeginCallstack( const QueueZoneBegin& ev ) +{ + auto zone = m_slab.AllocInit(); + ProcessZoneBeginImpl( zone, ev ); + + auto& next = m_nextCallstack[ev.thread]; + next.type = NextCallstackType::Zone; + next.zone = zone; +} + void Worker::ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev ) { auto it = m_pendingSourceLocationPayload.find( ev.srcloc ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index d8f19e82..bc64f4f1 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -119,6 +119,20 @@ class Worker float compRatio; }; + enum class NextCallstackType + { + Zone + }; + + struct NextCallstack + { + NextCallstackType type; + union + { + ZoneEvent* zone; + }; + }; + public: Worker( const char* addr ); Worker( FileRead& f, EventType::Type eventMask = EventType::All ); @@ -197,6 +211,7 @@ private: tracy_force_inline void DispatchProcess( const QueueItem& ev, char*& ptr ); tracy_force_inline void Process( const QueueItem& ev ); tracy_force_inline void ProcessZoneBegin( const QueueZoneBegin& ev ); + tracy_force_inline void ProcessZoneBeginCallstack( const QueueZoneBegin& ev ); tracy_force_inline void ProcessZoneBeginAllocSrcLoc( const QueueZoneBegin& ev ); tracy_force_inline void ProcessZoneEnd( const QueueZoneEnd& ev ); tracy_force_inline void ProcessFrameMark( const QueueFrameMark& ev ); @@ -224,6 +239,8 @@ private: tracy_force_inline void ProcessCallstackMemory( const QueueCallstackMemory& ev ); tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev ); + tracy_force_inline void ProcessZoneBeginImpl( ZoneEvent* zone, const QueueZoneBegin& ev ); + tracy_force_inline void CheckSourceLocation( uint64_t ptr ); void NewSourceLocation( uint64_t ptr ); tracy_force_inline uint32_t ShrinkSourceLocation( uint64_t srcloc ); @@ -306,6 +323,7 @@ private: Vector m_sourceLocationQueue; flat_hash_map> m_sourceLocationShrink; flat_hash_map> m_threadMap; + flat_hash_map> m_nextCallstack; uint32_t m_pendingStrings; uint32_t m_pendingThreads;