mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Native callstacks are now optional in allocated callstack messages.
This commit is contained in:
parent
c6b8c6a3a6
commit
c5c9dfb0c9
@ -1746,9 +1746,12 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
|||||||
break;
|
break;
|
||||||
case QueueType::CallstackAlloc:
|
case QueueType::CallstackAlloc:
|
||||||
ptr = MemRead<uint64_t>( &item->callstackAlloc.nativePtr );
|
ptr = MemRead<uint64_t>( &item->callstackAlloc.nativePtr );
|
||||||
CutCallstack( (void*)ptr, "lua_pcall" );
|
if( ptr != 0 )
|
||||||
SendCallstackPayload( ptr );
|
{
|
||||||
tracy_free( (void*)ptr );
|
CutCallstack( (void*)ptr, "lua_pcall" );
|
||||||
|
SendCallstackPayload( ptr );
|
||||||
|
tracy_free( (void*)ptr );
|
||||||
|
}
|
||||||
ptr = MemRead<uint64_t>( &item->callstackAlloc.ptr );
|
ptr = MemRead<uint64_t>( &item->callstackAlloc.ptr );
|
||||||
SendCallstackAlloc( ptr );
|
SendCallstackAlloc( ptr );
|
||||||
tracy_free( (void*)ptr );
|
tracy_free( (void*)ptr );
|
||||||
|
@ -2867,8 +2867,6 @@ void Worker::AddCallstackPayload( uint64_t ptr, const char* _data, size_t _sz )
|
|||||||
|
|
||||||
void Worker::AddCallstackAllocPayload( uint64_t ptr, const char* data, size_t _sz )
|
void Worker::AddCallstackAllocPayload( uint64_t ptr, const char* data, size_t _sz )
|
||||||
{
|
{
|
||||||
assert( m_pendingCallstackPtr != 0 );
|
|
||||||
|
|
||||||
CallstackFrameId stack[64];
|
CallstackFrameId stack[64];
|
||||||
const auto sz = *(uint32_t*)data; data += 4;
|
const auto sz = *(uint32_t*)data; data += 4;
|
||||||
assert( sz <= 64 );
|
assert( sz <= 64 );
|
||||||
@ -2904,17 +2902,31 @@ void Worker::AddCallstackAllocPayload( uint64_t ptr, const char* data, size_t _s
|
|||||||
stack[i] = id;
|
stack[i] = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto nativeCs = m_data.callstackPayload[m_pendingCallstackId];
|
VarArray<CallstackFrameId>* arr;
|
||||||
const auto nsz = nativeCs->size();
|
size_t memsize;
|
||||||
const auto tsz = sz + nsz;
|
if( m_pendingCallstackPtr != 0 )
|
||||||
|
{
|
||||||
|
const auto nativeCs = m_data.callstackPayload[m_pendingCallstackId];
|
||||||
|
const auto nsz = nativeCs->size();
|
||||||
|
const auto tsz = sz + nsz;
|
||||||
|
|
||||||
const auto memsize = sizeof( VarArray<CallstackFrameId> ) + tsz * sizeof( CallstackFrameId );
|
memsize = sizeof( VarArray<CallstackFrameId> ) + tsz * sizeof( CallstackFrameId );
|
||||||
auto mem = (char*)m_slab.AllocRaw( memsize );
|
auto mem = (char*)m_slab.AllocRaw( memsize );
|
||||||
memcpy( mem, stack, sizeof( CallstackFrameId ) * sz );
|
memcpy( mem, stack, sizeof( CallstackFrameId ) * sz );
|
||||||
memcpy( mem + sizeof( CallstackFrameId ) * sz, nativeCs->data(), sizeof( CallstackFrameId ) * nsz );
|
memcpy( mem + sizeof( CallstackFrameId ) * sz, nativeCs->data(), sizeof( CallstackFrameId ) * nsz );
|
||||||
|
|
||||||
auto arr = (VarArray<CallstackFrameId>*)( mem + tsz * sizeof( CallstackFrameId ) );
|
arr = (VarArray<CallstackFrameId>*)( mem + tsz * sizeof( CallstackFrameId ) );
|
||||||
new(arr) VarArray<CallstackFrameId>( tsz, (CallstackFrameId*)mem );
|
new(arr) VarArray<CallstackFrameId>( tsz, (CallstackFrameId*)mem );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memsize = sizeof( VarArray<CallstackFrameId> ) + sz * sizeof( CallstackFrameId );
|
||||||
|
auto mem = (char*)m_slab.AllocRaw( memsize );
|
||||||
|
memcpy( mem, stack, sizeof( CallstackFrameId ) * sz );
|
||||||
|
|
||||||
|
arr = (VarArray<CallstackFrameId>*)( mem + sz * sizeof( CallstackFrameId ) );
|
||||||
|
new(arr) VarArray<CallstackFrameId>( sz, (CallstackFrameId*)mem );
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t idx;
|
uint32_t idx;
|
||||||
auto it = m_data.callstackMap.find( arr );
|
auto it = m_data.callstackMap.find( arr );
|
||||||
|
Loading…
Reference in New Issue
Block a user