mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Send native callstack along with allocated callstack.
This commit is contained in:
parent
e13286936c
commit
d229c1bc1b
@ -182,8 +182,9 @@ static inline void SendLuaCallstack( lua_State* L, uint32_t depth )
|
||||
auto& tail = token->get_tail_index();
|
||||
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
|
||||
MemWrite( &item->hdr.type, QueueType::CallstackAlloc );
|
||||
MemWrite( &item->callstack.ptr, (uint64_t)ptr );
|
||||
MemWrite( &item->callstack.thread, GetThreadHandle() );
|
||||
MemWrite( &item->callstackAlloc.ptr, (uint64_t)ptr );
|
||||
MemWrite( &item->callstackAlloc.nativePtr, (uint64_t)Callstack( depth ) );
|
||||
MemWrite( &item->callstackAlloc.thread, GetThreadHandle() );
|
||||
tail.store( magic + 1, std::memory_order_release );
|
||||
}
|
||||
|
||||
|
@ -1325,10 +1325,15 @@ 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;
|
||||
case QueueType::CallstackAlloc:
|
||||
ptr = MemRead<uint64_t>( &item.callstackAlloc.ptr );
|
||||
tracy_free( (void*)ptr );
|
||||
ptr = MemRead<uint64_t>( &item.callstackAlloc.nativePtr );
|
||||
tracy_free( (void*)ptr );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
@ -1404,9 +1409,12 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
||||
tracy_free( (void*)ptr );
|
||||
break;
|
||||
case QueueType::CallstackAlloc:
|
||||
ptr = MemRead<uint64_t>( &item->callstack.ptr );
|
||||
ptr = MemRead<uint64_t>( &item->callstackAlloc.ptr );
|
||||
SendCallstackAlloc( ptr );
|
||||
tracy_free( (void*)ptr );
|
||||
ptr = MemRead<uint64_t>( &item->callstackAlloc.nativePtr );
|
||||
SendCallstackPayload( ptr );
|
||||
tracy_free( (void*)ptr );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
|
@ -9,7 +9,7 @@
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
enum : uint32_t { ProtocolVersion = 4 };
|
||||
enum : uint32_t { ProtocolVersion = 5 };
|
||||
|
||||
using lz4sz_t = uint32_t;
|
||||
|
||||
|
@ -249,6 +249,13 @@ struct QueueCallstack
|
||||
uint64_t thread;
|
||||
};
|
||||
|
||||
struct QueueCallstackAlloc
|
||||
{
|
||||
uint64_t ptr;
|
||||
uint64_t nativePtr;
|
||||
uint64_t thread;
|
||||
};
|
||||
|
||||
struct QueueCallstackFrameSize
|
||||
{
|
||||
uint64_t ptr;
|
||||
@ -312,6 +319,7 @@ struct QueueItem
|
||||
QueueMemFree memFree;
|
||||
QueueCallstackMemory callstackMemory;
|
||||
QueueCallstack callstack;
|
||||
QueueCallstackAlloc callstackAlloc;
|
||||
QueueCallstackFrameSize callstackFrameSize;
|
||||
QueueCallstackFrame callstackFrame;
|
||||
QueueCrashReport crashReport;
|
||||
@ -331,7 +339,7 @@ static const size_t QueueDataSize[] = {
|
||||
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // allocated source location, callstack
|
||||
sizeof( QueueHeader ) + sizeof( QueueCallstackMemory ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueCallstack ),
|
||||
sizeof( QueueHeader ) + sizeof( QueueCallstack ), // callstack alloc
|
||||
sizeof( QueueHeader ) + sizeof( QueueCallstackAlloc ),
|
||||
// above items must be first
|
||||
sizeof( QueueHeader ), // terminate
|
||||
sizeof( QueueHeader ), // keep alive
|
||||
|
Loading…
Reference in New Issue
Block a user