mirror of
https://github.com/wolfpld/tracy
synced 2025-05-07 23:43:52 +00:00
Callstack frame transfer.
This commit is contained in:
parent
359feae7ef
commit
5177a7b960
@ -559,6 +559,27 @@ void Profiler::SendCallstackPayload( uint64_t _ptr )
|
||||
}
|
||||
}
|
||||
|
||||
void Profiler::SendCallstackFrame( uint64_t ptr )
|
||||
{
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
auto frame = DecodeCallstackPtr( ptr );
|
||||
|
||||
SendString( uint64_t( frame.name ), frame.name, QueueType::CustomStringData );
|
||||
|
||||
QueueItem item;
|
||||
MemWrite( &item.hdr.type, QueueType::CallstackFrame );
|
||||
MemWrite( &item.callstackFrame.ptr, ptr );
|
||||
MemWrite( &item.callstackFrame.name, (uint64_t)frame.name );
|
||||
MemWrite( &item.callstackFrame.file, (uint64_t)frame.file );
|
||||
MemWrite( &item.callstackFrame.line, frame.line );
|
||||
|
||||
NeedDataSize( QueueDataSize[(int)QueueType::CallstackFrame] );
|
||||
AppendData( &item, QueueDataSize[(int)QueueType::CallstackFrame] );
|
||||
|
||||
tracy_free( (void*)frame.name );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static bool DontExit() { return false; }
|
||||
|
||||
@ -597,6 +618,9 @@ bool Profiler::HandleServerQuery()
|
||||
break;
|
||||
case ServerQueryTerminate:
|
||||
return false;
|
||||
case ServerQueryCallstackFrame:
|
||||
SendCallstackFrame( ptr );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
|
@ -301,6 +301,7 @@ private:
|
||||
void SendSourceLocation( uint64_t ptr );
|
||||
void SendSourceLocationPayload( uint64_t ptr );
|
||||
void SendCallstackPayload( uint64_t ptr );
|
||||
void SendCallstackFrame( uint64_t ptr );
|
||||
|
||||
bool HandleServerQuery();
|
||||
|
||||
|
@ -36,6 +36,7 @@ enum class QueueType : uint8_t
|
||||
MemFree,
|
||||
MemAllocCallstack,
|
||||
MemFreeCallstack,
|
||||
CallstackFrame,
|
||||
StringData,
|
||||
ThreadName,
|
||||
CustomStringData,
|
||||
@ -215,6 +216,14 @@ struct QueueCallstackMemory
|
||||
uint64_t ptr;
|
||||
};
|
||||
|
||||
struct QueueCallstackFrame
|
||||
{
|
||||
uint64_t ptr;
|
||||
uint64_t name;
|
||||
uint64_t file;
|
||||
uint32_t line;
|
||||
};
|
||||
|
||||
struct QueueHeader
|
||||
{
|
||||
union
|
||||
@ -250,6 +259,7 @@ struct QueueItem
|
||||
QueueMemAlloc memAlloc;
|
||||
QueueMemFree memFree;
|
||||
QueueCallstackMemory callstackMemory;
|
||||
QueueCallstackFrame callstackFrame;
|
||||
};
|
||||
};
|
||||
|
||||
@ -287,6 +297,7 @@ static const size_t QueueDataSize[] = {
|
||||
sizeof( QueueHeader ) + sizeof( QueueMemFree ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueMemAlloc ), // callstack
|
||||
sizeof( QueueHeader ) + sizeof( QueueMemFree ), // callstack
|
||||
sizeof( QueueHeader ) + sizeof( QueueCallstackFrame ),
|
||||
// keep all QueueStringTransfer below
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // string data
|
||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // thread name
|
||||
|
Loading…
x
Reference in New Issue
Block a user