1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-30 20:53:52 +00:00

Send lean memory callstacks.

This commit is contained in:
Bartosz Taudul 2020-05-10 19:28:08 +02:00
parent 2dc07fca0b
commit f0ade07be8
4 changed files with 11 additions and 7 deletions

View File

@ -2036,7 +2036,7 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
while( item != end ) while( item != end )
{ {
uint64_t ptr; uint64_t ptr;
const auto idx = MemRead<uint8_t>( &item->hdr.idx ); auto idx = MemRead<uint8_t>( &item->hdr.idx );
if( idx < (int)QueueType::Terminate ) if( idx < (int)QueueType::Terminate )
{ {
switch( (QueueType)idx ) switch( (QueueType)idx )
@ -2045,6 +2045,8 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
ptr = MemRead<uint64_t>( &item->callstackMemory.ptr ); ptr = MemRead<uint64_t>( &item->callstackMemory.ptr );
SendCallstackPayload( ptr ); SendCallstackPayload( ptr );
tracy_free( (void*)ptr ); tracy_free( (void*)ptr );
idx++;
MemWrite( &item->hdr.idx, idx );
break; break;
case QueueType::LockWait: case QueueType::LockWait:
case QueueType::LockSharedWait: case QueueType::LockSharedWait:

View File

@ -20,6 +20,7 @@ enum class QueueType : uint8_t
ZoneBeginAllocSrcLocCallstack, ZoneBeginAllocSrcLocCallstack,
ZoneBeginAllocSrcLocCallstackLean, ZoneBeginAllocSrcLocCallstackLean,
CallstackMemory, CallstackMemory,
CallstackMemoryLean,
Callstack, Callstack,
CallstackAlloc, CallstackAlloc,
CallstackSample, CallstackSample,
@ -482,7 +483,8 @@ static constexpr size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueZoneBeginLean ), // lean allocated source location sizeof( QueueHeader ) + sizeof( QueueZoneBeginLean ), // lean allocated source location
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // allocated source location, callstack, not for network transfer sizeof( QueueHeader ) + sizeof( QueueZoneBegin ), // allocated source location, callstack, not for network transfer
sizeof( QueueHeader ) + sizeof( QueueZoneBeginLean ), // lean allocated source location, callstack sizeof( QueueHeader ) + sizeof( QueueZoneBeginLean ), // lean allocated source location, callstack
sizeof( QueueHeader ) + sizeof( QueueCallstackMemory ), sizeof( QueueHeader ) + sizeof( QueueCallstackMemory ), // not for network transfer
sizeof( QueueHeader ), // lean callstack memory
sizeof( QueueHeader ) + sizeof( QueueCallstack ), sizeof( QueueHeader ) + sizeof( QueueCallstack ),
sizeof( QueueHeader ) + sizeof( QueueCallstackAlloc ), sizeof( QueueHeader ) + sizeof( QueueCallstackAlloc ),
sizeof( QueueHeader ) + sizeof( QueueCallstackSample ), sizeof( QueueHeader ) + sizeof( QueueCallstackSample ),

View File

@ -4182,8 +4182,8 @@ bool Worker::Process( const QueueItem& ev )
case QueueType::MemFreeCallstack: case QueueType::MemFreeCallstack:
ProcessMemFreeCallstack( ev.memFree ); ProcessMemFreeCallstack( ev.memFree );
break; break;
case QueueType::CallstackMemory: case QueueType::CallstackMemoryLean:
ProcessCallstackMemory( ev.callstackMemory ); ProcessCallstackMemory();
break; break;
case QueueType::Callstack: case QueueType::Callstack:
ProcessCallstack( ev.callstack ); ProcessCallstack( ev.callstack );
@ -5315,9 +5315,9 @@ void Worker::ProcessMemFreeCallstack( const QueueMemFree& ev )
} }
} }
void Worker::ProcessCallstackMemory( const QueueCallstackMemory& ev ) void Worker::ProcessCallstackMemory()
{ {
assert( m_pendingCallstackPtr == ev.ptr ); assert( m_pendingCallstackPtr != 0 );
m_pendingCallstackPtr = 0; m_pendingCallstackPtr = 0;
if( m_lastMemActionCallstack != std::numeric_limits<uint64_t>::max() ) if( m_lastMemActionCallstack != std::numeric_limits<uint64_t>::max() )

View File

@ -599,7 +599,7 @@ private:
tracy_force_inline bool ProcessMemFree( const QueueMemFree& ev ); tracy_force_inline bool ProcessMemFree( const QueueMemFree& ev );
tracy_force_inline void ProcessMemAllocCallstack( const QueueMemAlloc& ev ); tracy_force_inline void ProcessMemAllocCallstack( const QueueMemAlloc& ev );
tracy_force_inline void ProcessMemFreeCallstack( const QueueMemFree& ev ); tracy_force_inline void ProcessMemFreeCallstack( const QueueMemFree& ev );
tracy_force_inline void ProcessCallstackMemory( const QueueCallstackMemory& ev ); tracy_force_inline void ProcessCallstackMemory();
tracy_force_inline void ProcessCallstack( const QueueCallstack& ev ); tracy_force_inline void ProcessCallstack( const QueueCallstack& ev );
tracy_force_inline void ProcessCallstackAlloc( const QueueCallstackAlloc& ev ); tracy_force_inline void ProcessCallstackAlloc( const QueueCallstackAlloc& ev );
tracy_force_inline void ProcessCallstackSample( const QueueCallstackSample& ev ); tracy_force_inline void ProcessCallstackSample( const QueueCallstackSample& ev );