mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Send callstack alloc payload.
This commit is contained in:
parent
b8501956f9
commit
e3c31e4a4e
@ -1324,6 +1324,7 @@ static void FreeAssociatedMemory( const QueueItem& item )
|
|||||||
tracy_free( (void*)ptr );
|
tracy_free( (void*)ptr );
|
||||||
break;
|
break;
|
||||||
case QueueType::Callstack:
|
case QueueType::Callstack:
|
||||||
|
case QueueType::CallstackAlloc:
|
||||||
ptr = MemRead<uint64_t>( &item.callstack.ptr );
|
ptr = MemRead<uint64_t>( &item.callstack.ptr );
|
||||||
tracy_free( (void*)ptr );
|
tracy_free( (void*)ptr );
|
||||||
break;
|
break;
|
||||||
@ -1400,6 +1401,11 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
|||||||
SendCallstackPayload( ptr );
|
SendCallstackPayload( ptr );
|
||||||
tracy_free( (void*)ptr );
|
tracy_free( (void*)ptr );
|
||||||
break;
|
break;
|
||||||
|
case QueueType::CallstackAlloc:
|
||||||
|
ptr = MemRead<uint64_t>( &item->callstack.ptr );
|
||||||
|
SendCallstackAlloc( ptr );
|
||||||
|
tracy_free( (void*)ptr );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert( false );
|
assert( false );
|
||||||
break;
|
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 )
|
void Profiler::SendCallstackFrame( uint64_t ptr )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_HAS_CALLSTACK
|
#ifdef TRACY_HAS_CALLSTACK
|
||||||
|
@ -384,6 +384,7 @@ private:
|
|||||||
void SendSourceLocation( uint64_t ptr );
|
void SendSourceLocation( uint64_t ptr );
|
||||||
void SendSourceLocationPayload( uint64_t ptr );
|
void SendSourceLocationPayload( uint64_t ptr );
|
||||||
void SendCallstackPayload( uint64_t ptr );
|
void SendCallstackPayload( uint64_t ptr );
|
||||||
|
void SendCallstackAlloc( uint64_t ptr );
|
||||||
void SendCallstackFrame( uint64_t ptr );
|
void SendCallstackFrame( uint64_t ptr );
|
||||||
|
|
||||||
bool HandleServerQuery();
|
bool HandleServerQuery();
|
||||||
|
@ -56,6 +56,7 @@ enum class QueueType : uint8_t
|
|||||||
PlotName,
|
PlotName,
|
||||||
SourceLocationPayload,
|
SourceLocationPayload,
|
||||||
CallstackPayload,
|
CallstackPayload,
|
||||||
|
CallstackAllocPayload,
|
||||||
FrameName,
|
FrameName,
|
||||||
NUM_TYPES
|
NUM_TYPES
|
||||||
};
|
};
|
||||||
@ -372,6 +373,7 @@ static const size_t QueueDataSize[] = {
|
|||||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // plot name
|
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // plot name
|
||||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // allocated source location payload
|
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // allocated source location payload
|
||||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // callstack payload
|
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // callstack payload
|
||||||
|
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // callstack alloc payload
|
||||||
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // frame name
|
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // frame name
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user