1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +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 )
{
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 )
{
switch( (QueueType)idx )
@ -2045,6 +2045,8 @@ Profiler::DequeueStatus Profiler::DequeueSerial()
ptr = MemRead<uint64_t>( &item->callstackMemory.ptr );
SendCallstackPayload( ptr );
tracy_free( (void*)ptr );
idx++;
MemWrite( &item->hdr.idx, idx );
break;
case QueueType::LockWait:
case QueueType::LockSharedWait:

View File

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

View File

@ -4182,8 +4182,8 @@ bool Worker::Process( const QueueItem& ev )
case QueueType::MemFreeCallstack:
ProcessMemFreeCallstack( ev.memFree );
break;
case QueueType::CallstackMemory:
ProcessCallstackMemory( ev.callstackMemory );
case QueueType::CallstackMemoryLean:
ProcessCallstackMemory();
break;
case QueueType::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;
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 void ProcessMemAllocCallstack( const QueueMemAlloc& 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 ProcessCallstackAlloc( const QueueCallstackAlloc& ev );
tracy_force_inline void ProcessCallstackSample( const QueueCallstackSample& ev );