Favor transfer of zones without predicted payload.

This commit is contained in:
Bartosz Taudul 2017-11-22 02:28:12 +01:00
parent 630db7112a
commit c431747f06
2 changed files with 29 additions and 24 deletions

View File

@ -269,25 +269,29 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
while( item != end )
{
uint64_t ptr;
switch( item->hdr.type )
if( item->hdr.idx < (int)QueueType::Terminate )
{
case QueueType::ZoneText:
ptr = item->zoneText.text;
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
tracy_free( (void*)ptr );
break;
case QueueType::Message:
ptr = item->message.text;
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
tracy_free( (void*)ptr );
break;
case QueueType::ZoneBeginAllocSrcLoc:
ptr = item->zoneBegin.srcloc;
SendSourceLocationPayload( ptr );
tracy_free( (void*)ptr );
break;
default:
break;
switch( item->hdr.type )
{
case QueueType::ZoneText:
ptr = item->zoneText.text;
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
tracy_free( (void*)ptr );
break;
case QueueType::Message:
ptr = item->message.text;
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
tracy_free( (void*)ptr );
break;
case QueueType::ZoneBeginAllocSrcLoc:
ptr = item->zoneBegin.srcloc;
SendSourceLocationPayload( ptr );
tracy_free( (void*)ptr );
break;
default:
assert( false );
break;
}
}
if( !AppendData( item, QueueDataSize[item->hdr.idx] ) ) return ConnectionLost;
item++;

View File

@ -8,19 +8,19 @@ namespace tracy
enum class QueueType : uint8_t
{
ZoneText,
Message,
ZoneBeginAllocSrcLoc,
Terminate,
ZoneBegin,
ZoneBeginAllocSrcLoc,
ZoneEnd,
FrameMarkMsg,
SourceLocation,
ZoneText,
LockWait,
LockObtain,
LockRelease,
LockMark,
PlotData,
Message,
MessageLiteral,
GpuNewContext,
GpuZoneBegin,
@ -200,19 +200,20 @@ struct QueueItem
enum { QueueItemSize = sizeof( QueueItem ) };
static const size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueZoneText ),
sizeof( QueueHeader ) + sizeof( QueueMessage ),
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // allocated source location
// above items must be first
sizeof( QueueHeader ), // terminate
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ),
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // allocated source location
sizeof( QueueHeader ) + sizeof( QueueZoneEnd ),
sizeof( QueueHeader ) + sizeof( QueueFrameMark ),
sizeof( QueueHeader ) + sizeof( QueueSourceLocation ),
sizeof( QueueHeader ) + sizeof( QueueZoneText ),
sizeof( QueueHeader ) + sizeof( QueueLockWait ),
sizeof( QueueHeader ) + sizeof( QueueLockObtain ),
sizeof( QueueHeader ) + sizeof( QueueLockRelease ),
sizeof( QueueHeader ) + sizeof( QueueLockMark ),
sizeof( QueueHeader ) + sizeof( QueuePlotData ),
sizeof( QueueHeader ) + sizeof( QueueMessage ),
sizeof( QueueHeader ) + sizeof( QueueMessage ), // literal
sizeof( QueueHeader ) + sizeof( QueueGpuNewContext ),
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBegin ),