1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Issue predictive callback payload transfer.

This commit is contained in:
Bartosz Taudul 2018-06-19 19:09:57 +02:00
parent 51043ebc47
commit 0a8cd73db7
2 changed files with 17 additions and 2 deletions

View File

@ -419,7 +419,22 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
auto end = item + sz;
while( item != end )
{
uint64_t ptr;
const auto idx = MemRead<uint8_t>( &item->hdr.idx );
if( idx < (int)QueueType::Terminate )
{
switch( (QueueType)idx )
{
case QueueType::CallstackMemory:
ptr = MemRead<uint64_t>( &item->callstackMemory.ptr );
SendCallstackPayload( ptr );
tracy_free( (void*)ptr );
break;
default:
assert( false );
break;
}
}
if( !AppendData( item, QueueDataSize[idx] ) ) return ConnectionLost;
item++;
}

View File

@ -11,6 +11,7 @@ enum class QueueType : uint8_t
ZoneText,
Message,
ZoneBeginAllocSrcLoc,
CallstackMemory,
Terminate,
ZoneBegin,
ZoneEnd,
@ -35,7 +36,6 @@ enum class QueueType : uint8_t
MemFree,
MemAllocCallstack,
MemFreeCallstack,
CallstackMemory,
StringData,
ThreadName,
CustomStringData,
@ -261,6 +261,7 @@ static const size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueZoneText ),
sizeof( QueueHeader ) + sizeof( QueueMessage ),
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // allocated source location
sizeof( QueueHeader ) + sizeof( QueueCallstackMemory ),
// above items must be first
sizeof( QueueHeader ), // terminate
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ),
@ -286,7 +287,6 @@ static const size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueMemFree ),
sizeof( QueueHeader ) + sizeof( QueueMemAlloc ), // callstack
sizeof( QueueHeader ) + sizeof( QueueMemFree ), // callstack
sizeof( QueueHeader ) + sizeof( QueueCallstackMemory ),
// keep all QueueStringTransfer below
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // string data
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // thread name