mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Add client side fragmented blob support
This commit is contained in:
parent
1aeb661917
commit
f134e06594
@ -2464,7 +2464,7 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
||||
case QueueType::BlobCallstack:
|
||||
ptr = MemRead<uint64_t>( &item->blobData.data );
|
||||
size = MemRead<uint16_t>( &item->blobData.size );
|
||||
SendSingleString( (const char*)ptr, size );
|
||||
SendBlob( (const char*)ptr, size );
|
||||
tracy_free_fast( (void*)ptr );
|
||||
break;
|
||||
case QueueType::ZoneBeginAllocSrcLoc:
|
||||
@ -2999,7 +2999,7 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
|
||||
ThreadCtxCheckSerial( blobDataThread );
|
||||
ptr = MemRead<uint64_t>( &item->blobData.data );
|
||||
uint16_t size = MemRead<uint16_t>( &item->blobData.size );
|
||||
SendSingleString( (const char*)ptr, size );
|
||||
SendBlob( (const char*)ptr, size );
|
||||
tracy_free_fast( (void*)ptr );
|
||||
break;
|
||||
}
|
||||
@ -3267,6 +3267,23 @@ void Profiler::SendLongString( uint64_t str, const char* ptr, size_t len, QueueT
|
||||
AppendDataUnsafe( ptr, l32 );
|
||||
}
|
||||
|
||||
void Profiler::SendBlob( const char* ptr, size_t len )
|
||||
{
|
||||
QueueItem item;
|
||||
MemWrite( &item.hdr.type, QueueType::BlobFragment );
|
||||
while (len)
|
||||
{
|
||||
uint32_t fragment_size = len > TargetFrameSize ? TargetFrameSize : len;
|
||||
len -= fragment_size;
|
||||
|
||||
NeedDataSize( QueueDataSize[(int)QueueType::BlobFragment] + sizeof( fragment_size ) + fragment_size );
|
||||
|
||||
AppendDataUnsafe( &item, QueueDataSize[(int)QueueType::BlobFragment] );
|
||||
AppendDataUnsafe( &fragment_size, sizeof( fragment_size ) );
|
||||
AppendDataUnsafe( ptr, fragment_size );
|
||||
}
|
||||
}
|
||||
|
||||
void Profiler::SendSourceLocation( uint64_t ptr )
|
||||
{
|
||||
auto srcloc = (const SourceLocationData*)ptr;
|
||||
|
||||
@ -790,6 +790,8 @@ public:
|
||||
void SendSecondString( const char* ptr ) { SendSecondString( ptr, strlen( ptr ) ); }
|
||||
void SendSecondString( const char* ptr, size_t len );
|
||||
|
||||
void SendBlob( const char* ptr, size_t len );
|
||||
|
||||
|
||||
// Allocated source location data layout:
|
||||
// 2b payload size
|
||||
|
||||
@ -126,6 +126,7 @@ enum class QueueType : uint8_t
|
||||
SymbolCode,
|
||||
SourceCode,
|
||||
FiberName,
|
||||
BlobFragment,
|
||||
NUM_TYPES
|
||||
};
|
||||
|
||||
@ -931,6 +932,7 @@ static constexpr size_t QueueDataSize[] = {
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // symbol code
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // source code
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // fiber name
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // blob fragment
|
||||
};
|
||||
|
||||
static_assert( QueueItemSize == 32, "Queue item size not 32 bytes" );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user