diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 787c5afd..463515b9 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1843,6 +1843,8 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token ) int64_t dt = t - refCtx; refCtx = t; MemWrite( &item->callstackSample.time, dt ); + idx++; + MemWrite( &item->hdr.idx, idx ); break; } case QueueType::FrameImage: diff --git a/common/TracyQueue.hpp b/common/TracyQueue.hpp index 62e3a1c3..53dfb576 100644 --- a/common/TracyQueue.hpp +++ b/common/TracyQueue.hpp @@ -26,6 +26,7 @@ enum class QueueType : uint8_t CallstackAlloc, CallstackAllocLean, CallstackSample, + CallstackSampleLean, FrameImage, ZoneBegin, ZoneBeginCallstack, @@ -311,10 +312,14 @@ struct QueueCallstackAlloc uint64_t nativePtr; }; -struct QueueCallstackSample +struct QueueCallstackSampleLean { int64_t time; uint64_t thread; +}; + +struct QueueCallstackSample : public QueueCallstackSampleLean +{ uint64_t ptr; }; @@ -454,6 +459,7 @@ struct QueueItem QueueCallstack callstack; QueueCallstackAlloc callstackAlloc; QueueCallstackSample callstackSample; + QueueCallstackSampleLean callstackSampleLean; QueueCallstackFrameSize callstackFrameSize; QueueCallstackFrame callstackFrame; QueueSymbolInformation symbolInformation; @@ -491,7 +497,8 @@ static constexpr size_t QueueDataSize[] = { sizeof( QueueHeader ), // lean callstack sizeof( QueueHeader ) + sizeof( QueueCallstackAlloc ), // not for network transfer sizeof( QueueHeader ), // lean callstack alloc - sizeof( QueueHeader ) + sizeof( QueueCallstackSample ), + sizeof( QueueHeader ) + sizeof( QueueCallstackSample ), // not for network transfer + sizeof( QueueHeader ) + sizeof( QueueCallstackSampleLean ), sizeof( QueueHeader ) + sizeof( QueueFrameImage ), sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // callstack diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 438e8576..2e29778b 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -4191,8 +4191,8 @@ bool Worker::Process( const QueueItem& ev ) case QueueType::CallstackAllocLean: ProcessCallstackAlloc(); break; - case QueueType::CallstackSample: - ProcessCallstackSample( ev.callstackSample ); + case QueueType::CallstackSampleLean: + ProcessCallstackSample( ev.callstackSampleLean ); break; case QueueType::CallstackFrameSize: ProcessCallstackFrameSize( ev.callstackFrameSize ); @@ -5408,9 +5408,9 @@ void Worker::ProcessCallstackAlloc() } } -void Worker::ProcessCallstackSample( const QueueCallstackSample& ev ) +void Worker::ProcessCallstackSample( const QueueCallstackSampleLean& ev ) { - assert( m_pendingCallstackPtr == ev.ptr ); + assert( m_pendingCallstackPtr != 0 ); m_pendingCallstackPtr = 0; m_data.samplesCnt++; diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index d2b19d25..ca1eaed3 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -602,7 +602,7 @@ private: tracy_force_inline void ProcessCallstackMemory(); tracy_force_inline void ProcessCallstack(); tracy_force_inline void ProcessCallstackAlloc(); - tracy_force_inline void ProcessCallstackSample( const QueueCallstackSample& ev ); + tracy_force_inline void ProcessCallstackSample( const QueueCallstackSampleLean& ev ); tracy_force_inline void ProcessCallstackFrameSize( const QueueCallstackFrameSize& ev ); tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev ); tracy_force_inline void ProcessSymbolInformation( const QueueSymbolInformation& ev );