mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Calculate CPU data draw lists only if visible.
This commit is contained in:
parent
bb9219384f
commit
4b8ac41345
@ -59,16 +59,30 @@ void TimelineItemCpuData::Preprocess( const TimelineContext& ctx, TaskDispatch&
|
|||||||
|
|
||||||
if( !visible ) return;
|
if( !visible ) return;
|
||||||
|
|
||||||
|
const auto yMin = ctx.yMin;
|
||||||
|
const auto yMax = ctx.yMax;
|
||||||
|
const auto ty = ctx.ty;
|
||||||
|
const auto sty = ctx.sty;
|
||||||
|
const auto ostep = ty + 1;
|
||||||
|
const auto sstep = sty + 1;
|
||||||
|
|
||||||
|
auto pos = yPos + ostep;
|
||||||
|
|
||||||
#ifdef TRACY_NO_STATISTICS
|
#ifdef TRACY_NO_STATISTICS
|
||||||
if( m_view.GetViewData().drawCpuUsageGraph )
|
if( m_view.GetViewData().drawCpuUsageGraph )
|
||||||
#else
|
#else
|
||||||
if( m_view.GetViewData().drawCpuUsageGraph && m_worker.IsCpuUsageReady() )
|
if( m_view.GetViewData().drawCpuUsageGraph && m_worker.IsCpuUsageReady() )
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
const auto cpuUsageHeight = floor( 30.f * GetScale() );
|
||||||
|
if( pos <= yMax && pos + cpuUsageHeight + 3 >= yMin )
|
||||||
{
|
{
|
||||||
td.Queue( [this, &ctx] {
|
td.Queue( [this, &ctx] {
|
||||||
PreprocessCpuUsage( ctx );
|
PreprocessCpuUsage( ctx );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
pos += cpuUsageHeight + 3;
|
||||||
|
}
|
||||||
|
|
||||||
auto cpuData = m_worker.GetCpuData();
|
auto cpuData = m_worker.GetCpuData();
|
||||||
const auto cpuCnt = m_worker.GetCpuDataCpuCount();
|
const auto cpuCnt = m_worker.GetCpuDataCpuCount();
|
||||||
@ -77,12 +91,13 @@ void TimelineItemCpuData::Preprocess( const TimelineContext& ctx, TaskDispatch&
|
|||||||
for( int i=0; i<cpuCnt; i++ )
|
for( int i=0; i<cpuCnt; i++ )
|
||||||
{
|
{
|
||||||
auto& cs = cpuData[i].cs;
|
auto& cs = cpuData[i].cs;
|
||||||
if( !cs.empty() )
|
if( !cs.empty() && pos <= yMax && pos + sty >= yMin )
|
||||||
{
|
{
|
||||||
td.Queue( [this, &ctx, &cs, i] {
|
td.Queue( [this, &ctx, &cs, i] {
|
||||||
PreprocessCpuCtxSwitches( ctx, cs, m_ctxDraw[i] );
|
PreprocessCpuCtxSwitches( ctx, cs, m_ctxDraw[i] );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
pos += sstep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user