mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
Fix logic determining if there's CPU core usage data to draw.
This commit is contained in:
parent
1b824797a9
commit
d0ffca56bf
@ -41,8 +41,7 @@ int64_t TimelineItemCpuData::RangeEnd() const
|
|||||||
|
|
||||||
bool TimelineItemCpuData::DrawContents( const TimelineContext& ctx, int& offset )
|
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, m_hasCpuData );
|
||||||
m_view.DrawCpuData( ctx, m_cpuDraw, m_ctxDraw, offset, hasCpuData );
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +65,8 @@ void TimelineItemCpuData::Preprocess( const TimelineContext& ctx, TaskDispatch&
|
|||||||
const auto ostep = ty + 1;
|
const auto ostep = ty + 1;
|
||||||
const auto sstep = sty + 1;
|
const auto sstep = sty + 1;
|
||||||
|
|
||||||
|
m_hasCpuData = false;
|
||||||
|
|
||||||
auto pos = yPos + ostep;
|
auto pos = yPos + ostep;
|
||||||
|
|
||||||
#ifdef TRACY_NO_STATISTICS
|
#ifdef TRACY_NO_STATISTICS
|
||||||
@ -160,6 +161,7 @@ void TimelineItemCpuData::PreprocessCpuUsage( const TimelineContext& ctx )
|
|||||||
auto& ctxUsage = m_worker.GetCpuUsage();
|
auto& ctxUsage = m_worker.GetCpuUsage();
|
||||||
if( !ctxUsage.empty() )
|
if( !ctxUsage.empty() )
|
||||||
{
|
{
|
||||||
|
m_hasCpuData = true;
|
||||||
auto itBegin = ctxUsage.begin();
|
auto itBegin = ctxUsage.begin();
|
||||||
for( size_t i=0; i<num; i++ )
|
for( size_t i=0; i<num; i++ )
|
||||||
{
|
{
|
||||||
@ -202,6 +204,7 @@ void TimelineItemCpuData::PreprocessCpuUsage( const TimelineContext& ctx )
|
|||||||
auto& cs = cpuData[i].cs;
|
auto& cs = cpuData[i].cs;
|
||||||
if( !cs.empty() )
|
if( !cs.empty() )
|
||||||
{
|
{
|
||||||
|
m_hasCpuData = true;
|
||||||
auto itBegin = cs.begin();
|
auto itBegin = cs.begin();
|
||||||
auto ptr = m_cpuDraw.data();
|
auto ptr = m_cpuDraw.data();
|
||||||
for( size_t i=0; i<num; i++ )
|
for( size_t i=0; i<num; i++ )
|
||||||
|
@ -38,6 +38,8 @@ private:
|
|||||||
|
|
||||||
std::vector<CpuUsageDraw> m_cpuDraw;
|
std::vector<CpuUsageDraw> m_cpuDraw;
|
||||||
std::vector<std::vector<CpuCtxDraw>> m_ctxDraw;
|
std::vector<std::vector<CpuCtxDraw>> m_ctxDraw;
|
||||||
|
|
||||||
|
bool m_hasCpuData;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user