Send lean callstack samples.

This commit is contained in:
Bartosz Taudul 2020-05-10 20:00:51 +02:00
parent 09388f3c99
commit 03b5dfacd6
4 changed files with 16 additions and 7 deletions

View File

@ -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:

View File

@ -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

View File

@ -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++;

View File

@ -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 );