1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Process explicit context switch callstack samples.

This commit is contained in:
Bartosz Taudul 2021-12-21 14:18:32 +01:00
parent 3f1c540b3a
commit c5654c333a
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 25 additions and 0 deletions

View File

@ -4819,6 +4819,9 @@ bool Worker::Process( const QueueItem& ev )
case QueueType::CallstackSample:
ProcessCallstackSample( ev.callstackSample );
break;
case QueueType::CallstackSampleContextSwitch:
ProcessCallstackSampleContextSwitch( ev.callstackSample );
break;
case QueueType::CallstackFrameSize:
ProcessCallstackFrameSize( ev.callstackFrameSize );
m_serverQuerySpaceLeft++;
@ -6511,6 +6514,27 @@ void Worker::ProcessCallstackSample( const QueueCallstackSample& ev )
}
}
void Worker::ProcessCallstackSampleContextSwitch( const QueueCallstackSample& ev )
{
assert( m_pendingCallstackId != 0 );
const auto callstack = m_pendingCallstackId;
m_pendingCallstackId = 0;
const auto refTime = m_refTimeCtx + ev.time;
m_refTimeCtx = refTime;
const auto t = refTime == 0 ? 0 : TscTime( refTime - m_data.baseTime );
auto& td = *NoticeThread( ev.thread );
SampleData sd;
sd.time.SetVal( t );
sd.callstack.SetVal( callstack );
ProcessCallstackSampleInsertSample( sd, td );
td.ctxSwitchSamples.push_back( sd );
}
void Worker::ProcessCallstackFrameSize( const QueueCallstackFrameSize& ev )
{
assert( !m_callstackFrameStaging );

View File

@ -695,6 +695,7 @@ private:
tracy_force_inline void ProcessCallstackSerial();
tracy_force_inline void ProcessCallstack();
tracy_force_inline void ProcessCallstackSample( const QueueCallstackSample& ev );
tracy_force_inline void ProcessCallstackSampleContextSwitch( const QueueCallstackSample& ev );
tracy_force_inline void ProcessCallstackFrameSize( const QueueCallstackFrameSize& ev );
tracy_force_inline void ProcessCallstackFrame( const QueueCallstackFrame& ev, bool querySymbols );
tracy_force_inline void ProcessSymbolInformation( const QueueSymbolInformation& ev );