Separate message type for context switch callstack samples.

This commit is contained in:
Bartosz Taudul 2021-12-21 14:05:07 +01:00
parent 0ba2c0a86e
commit d88bf2c7a8
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
5 changed files with 9 additions and 2 deletions

View File

@ -2090,6 +2090,7 @@ static void FreeAssociatedMemory( const QueueItem& item )
tracy_free( (void*)ptr );
break;
case QueueType::CallstackSample:
case QueueType::CallstackSampleContextSwitch:
ptr = MemRead<uint64_t>( &item.callstackSampleFat.ptr );
tracy_free( (void*)ptr );
break;
@ -2283,6 +2284,7 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
tracy_free_fast( (void*)ptr );
break;
case QueueType::CallstackSample:
case QueueType::CallstackSampleContextSwitch:
{
ptr = MemRead<uint64_t>( &item->callstackSampleFat.ptr );
SendCallstackPayload64( ptr );

View File

@ -1401,7 +1401,7 @@ void SysTraceWorker( void* ptr )
{
auto trace = GetCallstackBlock( cnt, ring, traceOffset );
TracyLfqPrepare( QueueType::CallstackSample );
TracyLfqPrepare( QueueType::CallstackSampleContextSwitch );
MemWrite( &item->callstackSampleFat.time, t0 );
MemWrite( &item->callstackSampleFat.thread, prev_pid );
MemWrite( &item->callstackSampleFat.ptr, (uint64_t)trace );

View File

@ -9,7 +9,7 @@ namespace tracy
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
enum : uint32_t { ProtocolVersion = 54 };
enum : uint32_t { ProtocolVersion = 55 };
enum : uint16_t { BroadcastVersion = 2 };
using lz4sz_t = uint32_t;

View File

@ -21,6 +21,7 @@ enum class QueueType : uint8_t
Callstack,
CallstackAlloc,
CallstackSample,
CallstackSampleContextSwitch,
FrameImage,
ZoneBegin,
ZoneBeginCallstack,
@ -741,6 +742,7 @@ static constexpr size_t QueueDataSize[] = {
sizeof( QueueHeader ), // callstack
sizeof( QueueHeader ), // callstack alloc
sizeof( QueueHeader ) + sizeof( QueueCallstackSample ),
sizeof( QueueHeader ) + sizeof( QueueCallstackSample ), // context switch
sizeof( QueueHeader ) + sizeof( QueueFrameImage ),
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ),
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // callstack

View File

@ -52,6 +52,9 @@ void EventDebug( const QueueItem& ev )
case QueueType::CallstackSample:
fprintf( f, "ev %i (CallstackSample)\n", ev.hdr.idx );
break;
case QueueType::CallstackSampleContextSwitch:
fprintf( f, "ev %i (CallstackSampleContextSwitch)\n", ev.hdr.idx );
break;
case QueueType::FrameImage:
fprintf( f, "ev %i (FrameImage)\n", ev.hdr.idx );
break;