Fix logic determining if there's CPU core usage data to draw.

This commit is contained in:
Bartosz Taudul 2023-04-07 22:26:36 +02:00
parent 1b824797a9
commit d0ffca56bf
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 7 additions and 2 deletions

View File

@ -41,8 +41,7 @@ int64_t TimelineItemCpuData::RangeEnd() const
bool TimelineItemCpuData::DrawContents( const TimelineContext& ctx, int& offset )
{
const bool hasCpuData = m_worker.IsCpuUsageReady() && !m_worker.GetCpuUsage().empty();
m_view.DrawCpuData( ctx, m_cpuDraw, m_ctxDraw, offset, hasCpuData );
m_view.DrawCpuData( ctx, m_cpuDraw, m_ctxDraw, offset, m_hasCpuData );
return true;
}
@ -66,6 +65,8 @@ void TimelineItemCpuData::Preprocess( const TimelineContext& ctx, TaskDispatch&
const auto ostep = ty + 1;
const auto sstep = sty + 1;
m_hasCpuData = false;
auto pos = yPos + ostep;
#ifdef TRACY_NO_STATISTICS
@ -160,6 +161,7 @@ void TimelineItemCpuData::PreprocessCpuUsage( const TimelineContext& ctx )
auto& ctxUsage = m_worker.GetCpuUsage();
if( !ctxUsage.empty() )
{
m_hasCpuData = true;
auto itBegin = ctxUsage.begin();
for( size_t i=0; i<num; i++ )
{
@ -202,6 +204,7 @@ void TimelineItemCpuData::PreprocessCpuUsage( const TimelineContext& ctx )
auto& cs = cpuData[i].cs;
if( !cs.empty() )
{
m_hasCpuData = true;
auto itBegin = cs.begin();
auto ptr = m_cpuDraw.data();
for( size_t i=0; i<num; i++ )

View File

@ -38,6 +38,8 @@ private:
std::vector<CpuUsageDraw> m_cpuDraw;
std::vector<std::vector<CpuCtxDraw>> m_ctxDraw;
bool m_hasCpuData;
};
}