Replace previous iterator manipulation with a boolean.

This commit is contained in:
Bartosz Taudul 2023-03-25 00:22:03 +01:00
parent efa095e25f
commit 1e63406ac7
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -472,11 +472,15 @@ void TimelineItemThread::PreprocessContextSwitches( const TimelineContext& ctx,
const auto MinCtxNs = int64_t( round( GetScale() * MinCtxSize * nspx ) ); const auto MinCtxNs = int64_t( round( GetScale() * MinCtxSize * nspx ) );
const auto& sampleData = m_thread->samples; const auto& sampleData = m_thread->samples;
auto pit = citend; bool first = true;
while( it < citend ) while( it < citend )
{ {
auto& ev = *it; auto& ev = *it;
if( pit != citend ) if( first )
{
first = false;
}
else
{ {
uint32_t waitStack = 0; uint32_t waitStack = 0;
if( !sampleData.empty() ) if( !sampleData.empty() )
@ -513,12 +517,10 @@ void TimelineItemThread::PreprocessContextSwitches( const TimelineContext& ctx,
} }
m_ctxDraw.emplace_back( ContextSwitchDraw { ContextSwitchDrawType::Folded, uint32_t( it - vec.begin() ), uint32_t( next - it ) } ); m_ctxDraw.emplace_back( ContextSwitchDraw { ContextSwitchDrawType::Folded, uint32_t( it - vec.begin() ), uint32_t( next - it ) } );
it = next; it = next;
pit = it-1;
} }
else else
{ {
m_ctxDraw.emplace_back( ContextSwitchDraw { ContextSwitchDrawType::Running, uint32_t( it - vec.begin() ) } ); m_ctxDraw.emplace_back( ContextSwitchDraw { ContextSwitchDrawType::Running, uint32_t( it - vec.begin() ) } );
pit = it;
++it; ++it;
} }
} }