Process callstack frames.

This commit is contained in:
Bartosz Taudul 2018-06-20 01:07:09 +02:00
parent 5177a7b960
commit 0c0afa5ac7
2 changed files with 26 additions and 0 deletions

View File

@ -1545,6 +1545,9 @@ void Worker::Process( const QueueItem& ev )
case QueueType::CallstackMemory: case QueueType::CallstackMemory:
ProcessCallstackMemory( ev.callstackMemory ); ProcessCallstackMemory( ev.callstackMemory );
break; break;
case QueueType::CallstackFrame:
ProcessCallstackFrame( ev.callstackFrame );
break;
case QueueType::Terminate: case QueueType::Terminate:
m_terminate = true; m_terminate = true;
break; break;
@ -2097,6 +2100,28 @@ void Worker::ProcessCallstackMemory( const QueueCallstackMemory& ev )
m_pendingCallstacks.erase( it ); m_pendingCallstacks.erase( it );
} }
void Worker::ProcessCallstackFrame( const QueueCallstackFrame& ev )
{
auto fmit = m_data.callstackFrameMap.find( ev.ptr );
auto it = m_pendingCustomStrings.find( ev.name );
assert( it != m_pendingCustomStrings.end() );
// Frames may be duplicated due to recursion
if( fmit == m_data.callstackFrameMap.end() )
{
CheckString( ev.file );
auto frame = m_slab.Alloc<CallstackFrame>();
frame->name = StringIdx( it->second.idx );
frame->file = ev.file;
frame->line = ev.line;
m_data.callstackFrameMap.emplace( ev.ptr, frame );
}
m_pendingCustomStrings.erase( it );
}
void Worker::MemAllocChanged( int64_t time ) void Worker::MemAllocChanged( int64_t time )
{ {
const auto val = (double)m_data.memory.usage; const auto val = (double)m_data.memory.usage;

View File

@ -220,6 +220,7 @@ private:
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( const QueueCallstackMemory& ev );
tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev );
tracy_force_inline void CheckSourceLocation( uint64_t ptr ); tracy_force_inline void CheckSourceLocation( uint64_t ptr );
void NewSourceLocation( uint64_t ptr ); void NewSourceLocation( uint64_t ptr );