From d0ffca56bf4b645b425f0f0bdbebabf05984ebf5 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 7 Apr 2023 22:26:36 +0200 Subject: [PATCH] Fix logic determining if there's CPU core usage data to draw. --- server/TracyTimelineItemCpuData.cpp | 7 +++++-- server/TracyTimelineItemCpuData.hpp | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/TracyTimelineItemCpuData.cpp b/server/TracyTimelineItemCpuData.cpp index 619e8ba6..d3b320b8 100644 --- a/server/TracyTimelineItemCpuData.cpp +++ b/server/TracyTimelineItemCpuData.cpp @@ -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 m_cpuDraw; std::vector> m_ctxDraw; + + bool m_hasCpuData; }; }