mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Do not project running regions end time to last time.
Just display known running regions, keeping the unended ones infinitely collapsed. This makes the CPU core usage graph possibly display wrong data at the end of capture. Note that this behavior was also present in previous releases.
This commit is contained in:
parent
1ff9e0012b
commit
1b824797a9
@ -109,7 +109,7 @@ void TimelineItemCpuData::PreprocessCpuCtxSwitches( const TimelineContext& ctx,
|
||||
const auto vEnd = ctx.vEnd;
|
||||
const auto nspx = ctx.nspx;
|
||||
|
||||
auto it = std::lower_bound( cs.begin(), cs.end(), std::max<int64_t>( 0, vStart ), [this] ( const auto& l, const auto& r ) { return ( l.IsEndValid() ? l.End() : m_worker.GetLastTime() ) < r; } );
|
||||
auto it = std::lower_bound( cs.begin(), cs.end(), std::max<int64_t>( 0, vStart ), [] ( const auto& l, const auto& r ) { return ( l.IsEndValid() ? l.End() : l.Start() ) < r; } );
|
||||
if( it == cs.end() ) return;
|
||||
auto eit = std::lower_bound( it, cs.end(), vEnd, [] ( const auto& l, const auto& r ) { return l.Start() < r; } );
|
||||
if( it == eit ) return;
|
||||
@ -118,7 +118,7 @@ void TimelineItemCpuData::PreprocessCpuCtxSwitches( const TimelineContext& ctx,
|
||||
|
||||
while( it < eit )
|
||||
{
|
||||
const auto end = it->IsEndValid() ? it->End() : m_worker.GetLastTime();
|
||||
const auto end = it->IsEndValid() ? it->End() : it->Start();
|
||||
const auto zsz = end - it->Start();
|
||||
if( zsz < MinVisNs )
|
||||
{
|
||||
@ -126,11 +126,11 @@ void TimelineItemCpuData::PreprocessCpuCtxSwitches( const TimelineContext& ctx,
|
||||
auto next = it + 1;
|
||||
for(;;)
|
||||
{
|
||||
next = std::lower_bound( next, eit, nextTime, [this] ( const auto& l, const auto& r ) { return ( l.IsEndValid() ? l.End() : m_worker.GetLastTime() ) < r; } );
|
||||
next = std::lower_bound( next, eit, nextTime, [] ( const auto& l, const auto& r ) { return ( l.IsEndValid() ? l.End() : l.Start() ) < r; } );
|
||||
if( next == eit ) break;
|
||||
auto prev = next - 1;
|
||||
const auto pt = prev->IsEndValid() ? prev->End() : m_worker.GetLastTime();
|
||||
const auto nt = next->IsEndValid() ? next->End() : m_worker.GetLastTime();
|
||||
const auto pt = prev->IsEndValid() ? prev->End() : prev->Start();
|
||||
const auto nt = next->IsEndValid() ? next->End() : next->Start();
|
||||
if( nt - pt >= MinVisNs ) break;
|
||||
nextTime = nt + MinVisNs;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ void TimelineItemThread::PreprocessContextSwitches( const TimelineContext& ctx,
|
||||
m_ctxDraw.emplace_back( ContextSwitchDraw { ContextSwitchDrawType::Waiting, uint32_t( it - vec.begin() ), waitStack } );
|
||||
}
|
||||
|
||||
const auto end = ev.IsEndValid() ? ev.End() : m_worker.GetLastTime();
|
||||
const auto end = ev.IsEndValid() ? ev.End() : ev.Start();
|
||||
const auto zsz = end - ev.Start();
|
||||
if( zsz < MinCtxNs )
|
||||
{
|
||||
@ -515,11 +515,11 @@ void TimelineItemThread::PreprocessContextSwitches( const TimelineContext& ctx,
|
||||
auto next = it + 1;
|
||||
for(;;)
|
||||
{
|
||||
next = std::lower_bound( next, citend, nextTime, [this] ( const auto& l, const auto& r ) { return ( l.IsEndValid() ? l.End() : m_worker.GetLastTime() ) < r; } );
|
||||
next = std::lower_bound( next, citend, nextTime, [] ( const auto& l, const auto& r ) { return ( l.IsEndValid() ? l.End() : l.Start() ) < r; } );
|
||||
if( next == citend ) break;
|
||||
auto prev = next - 1;
|
||||
const auto pt = prev->IsEndValid() ? prev->End() : m_worker.GetLastTime();
|
||||
const auto nt = next->IsEndValid() ? next->End() : m_worker.GetLastTime();
|
||||
const auto pt = prev->IsEndValid() ? prev->End() : prev->Start();
|
||||
const auto nt = next->IsEndValid() ? next->End() : next->Start();
|
||||
if( nt - pt >= MinCtxNs ) break;
|
||||
nextTime = nt + MinCtxNs;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ void View::DrawContextSwitchList( const TimelineContext& ctx, const std::vector<
|
||||
const auto num = v.data;
|
||||
const auto px0 = std::max( ( ev.Start() - vStart ) * pxns, -10.0 );
|
||||
const auto eit = it + num - 1;
|
||||
const auto end = eit->IsEndValid() ? eit->End() : m_worker.GetLastTime();
|
||||
const auto end = eit->IsEndValid() ? eit->End() : eit->Start();
|
||||
const auto px1ns = end - vStart;
|
||||
minpx = std::min( std::max( px1ns * pxns, px0+MinCtxSize ), double( w + 10 ) );
|
||||
if( num == 1 )
|
||||
@ -313,7 +313,7 @@ void View::DrawContextSwitchList( const TimelineContext& ctx, const std::vector<
|
||||
}
|
||||
case ContextSwitchDrawType::Running:
|
||||
{
|
||||
const auto end = ev.IsEndValid() ? ev.End() : m_worker.GetLastTime();
|
||||
const auto end = ev.IsEndValid() ? ev.End() : ev.Start();
|
||||
const auto px0 = std::max( { ( ev.Start() - vStart ) * pxns, -10.0, double( minpx ) } );
|
||||
const auto px1 = std::min( ( end - vStart ) * pxns, w + 10.0 );
|
||||
DrawLine( draw, dpos + ImVec2( px0, offset + ty05 - 0.5f ), dpos + ImVec2( px1, offset + ty05 - 0.5f ), 0xFF22DD22, lineSize );
|
||||
|
@ -160,7 +160,7 @@ bool View::DrawCpuData( const TimelineContext& ctx, const std::vector<CpuUsageDr
|
||||
if( v.num > 0 )
|
||||
{
|
||||
const auto& eev = cs[v.idx + v.num - 1];
|
||||
const auto t1 = eev.IsEndValid() ? eev.End() : m_worker.GetLastTime();
|
||||
const auto t1 = eev.IsEndValid() ? eev.End() : eev.Start();
|
||||
const auto px1 = ( t1 - vStart ) * pxns;
|
||||
DrawZigZag( draw, wpos + ImVec2( 0, offset + sty/2 ), std::max( px0, -10.0 ), std::min( std::max( px1, px0+MinVisSize ), double( w + 10 ) ), sty/4, 0xFF888888 );
|
||||
|
||||
@ -194,7 +194,7 @@ bool View::DrawCpuData( const TimelineContext& ctx, const std::vector<CpuUsageDr
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto end = ev.IsEndValid() ? ev.End() : m_worker.GetLastTime();
|
||||
const auto end = ev.IsEndValid() ? ev.End() : ev.Start();
|
||||
const auto px1 = ( end - vStart ) * pxns;
|
||||
|
||||
const auto thread = m_worker.DecompressThreadExternal( ev.Thread() );
|
||||
|
Loading…
Reference in New Issue
Block a user