mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Detect context switch samples during reconstruction.
This commit is contained in:
parent
484ed84252
commit
0ab73e2aa7
@ -1953,7 +1953,25 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
for( auto& t : m_data.threads )
|
||||
{
|
||||
if( m_shutdown.load( std::memory_order_relaxed ) ) return;
|
||||
auto ctx = GetContextSwitchData( t->id );
|
||||
Vector<ContextSwitchData>::const_iterator cit = nullptr;
|
||||
if( ctx ) cit = ctx->v.begin();
|
||||
for( auto& sd : t->samples )
|
||||
{
|
||||
bool isCtxSwitch = false;
|
||||
if( ctx )
|
||||
{
|
||||
cit = std::lower_bound( cit, ctx->v.end(), sd.time.Val(), [] ( const auto& l, const auto& r ) { return (uint64_t)l.End() < (uint64_t)r; } );
|
||||
if( cit != ctx->v.end() )
|
||||
{
|
||||
if( sd.time.Val() == cit->Start() )
|
||||
{
|
||||
isCtxSwitch = true;
|
||||
t->ctxSwitchSamples.push_back( sd );
|
||||
}
|
||||
}
|
||||
}
|
||||
if( !isCtxSwitch )
|
||||
{
|
||||
const auto cs = sd.callstack.Val();
|
||||
auto it = counts.find( cs );
|
||||
@ -1992,6 +2010,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for( auto& v : counts ) UpdateSampleStatistics( v.first, v.second, false );
|
||||
}
|
||||
std::lock_guard<std::mutex> lock( m_data.lock );
|
||||
|
Loading…
Reference in New Issue
Block a user