mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Callstack payload transfer.
This commit is contained in:
parent
55e6a4a484
commit
51043ebc47
@ -520,6 +520,31 @@ void Profiler::SendSourceLocationPayload( uint64_t _ptr )
|
||||
AppendData( ptr + 4, l16 );
|
||||
}
|
||||
|
||||
void Profiler::SendCallstackPayload( uint64_t _ptr )
|
||||
{
|
||||
auto ptr = (uintptr_t*)_ptr;
|
||||
|
||||
QueueItem item;
|
||||
MemWrite( &item.hdr.type, QueueType::CallstackPayload );
|
||||
MemWrite( &item.stringTransfer.ptr, _ptr );
|
||||
|
||||
const auto sz = *ptr++;
|
||||
const auto len = sz * sizeof( uint64_t );
|
||||
const auto l16 = uint16_t( len );
|
||||
|
||||
NeedDataSize( QueueDataSize[(int)QueueType::CallstackPayload] + sizeof( l16 ) + l16 );
|
||||
|
||||
AppendData( &item, QueueDataSize[(int)QueueType::CallstackPayload] );
|
||||
AppendData( &l16, sizeof( l16 ) );
|
||||
|
||||
for( uintptr_t i=0; i<sz; i++ )
|
||||
{
|
||||
const auto val = uint64_t( *ptr++ );
|
||||
AppendData( &val, sizeof( uint64_t ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool DontExit() { return false; }
|
||||
|
||||
bool Profiler::HandleServerQuery()
|
||||
|
@ -298,6 +298,7 @@ private:
|
||||
void SendString( uint64_t ptr, const char* str, QueueType type );
|
||||
void SendSourceLocation( uint64_t ptr );
|
||||
void SendSourceLocationPayload( uint64_t ptr );
|
||||
void SendCallstackPayload( uint64_t ptr );
|
||||
|
||||
bool HandleServerQuery();
|
||||
|
||||
|
@ -41,6 +41,7 @@ enum class QueueType : uint8_t
|
||||
CustomStringData,
|
||||
PlotName,
|
||||
SourceLocationPayload,
|
||||
CallstackPayload,
|
||||
NUM_TYPES
|
||||
};
|
||||
|
||||
@ -292,6 +293,7 @@ static const size_t QueueDataSize[] = {
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // custom string data
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // plot name
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // allocated source location payload
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // callstack payload
|
||||
};
|
||||
|
||||
static_assert( QueueItemSize == 32, "Queue item size not 32 bytes" );
|
||||
|
Loading…
Reference in New Issue
Block a user