Send callstack alloc payload.

This commit is contained in:
Bartosz Taudul 2019-02-28 20:30:07 +01:00
parent b8501956f9
commit e3c31e4a4e
3 changed files with 28 additions and 0 deletions

View File

@ -1324,6 +1324,7 @@ static void FreeAssociatedMemory( const QueueItem& item )
tracy_free( (void*)ptr );
break;
case QueueType::Callstack:
case QueueType::CallstackAlloc:
ptr = MemRead<uint64_t>( &item.callstack.ptr );
tracy_free( (void*)ptr );
break;
@ -1400,6 +1401,11 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
SendCallstackPayload( ptr );
tracy_free( (void*)ptr );
break;
case QueueType::CallstackAlloc:
ptr = MemRead<uint64_t>( &item->callstack.ptr );
SendCallstackAlloc( ptr );
tracy_free( (void*)ptr );
break;
default:
assert( false );
break;
@ -1587,6 +1593,25 @@ void Profiler::SendCallstackPayload( uint64_t _ptr )
}
}
void Profiler::SendCallstackAlloc( uint64_t _ptr )
{
auto ptr = (const char*)_ptr;
QueueItem item;
MemWrite( &item.hdr.type, QueueType::CallstackAllocPayload );
MemWrite( &item.stringTransfer.ptr, _ptr );
const auto len = *((uint32_t*)ptr);
assert( len <= std::numeric_limits<uint16_t>::max() );
const auto l16 = uint16_t( len );
NeedDataSize( QueueDataSize[(int)QueueType::CallstackAllocPayload] + sizeof( l16 ) + l16 );
AppendDataUnsafe( &item, QueueDataSize[(int)QueueType::CallstackAllocPayload] );
AppendDataUnsafe( &l16, sizeof( l16 ) );
AppendDataUnsafe( ptr + 4, l16 );
}
void Profiler::SendCallstackFrame( uint64_t ptr )
{
#ifdef TRACY_HAS_CALLSTACK

View File

@ -384,6 +384,7 @@ private:
void SendSourceLocation( uint64_t ptr );
void SendSourceLocationPayload( uint64_t ptr );
void SendCallstackPayload( uint64_t ptr );
void SendCallstackAlloc( uint64_t ptr );
void SendCallstackFrame( uint64_t ptr );
bool HandleServerQuery();

View File

@ -56,6 +56,7 @@ enum class QueueType : uint8_t
PlotName,
SourceLocationPayload,
CallstackPayload,
CallstackAllocPayload,
FrameName,
NUM_TYPES
};
@ -372,6 +373,7 @@ static const size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // plot name
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // allocated source location payload
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // callstack payload
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // callstack alloc payload
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // frame name
};