From fdff47ecdb1392fad5f47ecf6cde5e29db9249dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gr=C3=A9goire?= Date: Wed, 9 Apr 2025 14:40:25 +0200 Subject: [PATCH] Add culling for the thread wakeups --- profiler/src/profiler/TracyView_CpuData.cpp | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/profiler/src/profiler/TracyView_CpuData.cpp b/profiler/src/profiler/TracyView_CpuData.cpp index a0df968f..3b9eda7a 100644 --- a/profiler/src/profiler/TracyView_CpuData.cpp +++ b/profiler/src/profiler/TracyView_CpuData.cpp @@ -429,7 +429,8 @@ bool View::DrawCpuData( const TimelineContext& ctx, const std::vectorWakeupVal(); const auto wakeupcpu = it->WakeupCpu(); const auto pw = computeScreenPos( wakeup, wakeupcpu ); - - const auto hue = 0.38f * float( waitReason ); // Golden angle - const auto wakecolor = ImColor::HSV( hue, 1.f, 1.f ); + const auto wakeupWidthPixels = p1.x - pw.x; + if( ( migrationWidthPixels >= 30 ) || ( wakeupWidthPixels >= 0.5 ) ) + { + const auto hue = 0.38f * float( waitReason ); // Golden angle + const auto wakecolor = ImColor::HSV( hue, 1.f, 1.f ); - DrawLine( draw, pw, p1, wakecolor ); - draw->AddCircleFilled( pw, bgSize, wakecolor ); - DrawLine( draw, ImVec2{ p1.x ,p1.y - sty * 0.75f }, ImVec2{ p1.x , p1.y + sty * 0.75f }, 0xFF000000, bgSize ); - DrawLine( draw, ImVec2{ p1.x ,p1.y - sty * 0.75f }, ImVec2{ p1.x , p1.y + sty * 0.75f }, wakecolor ); + DrawLine( draw, pw, p1, wakecolor ); + draw->AddCircleFilled( pw, bgSize, wakecolor ); + + // Vertical line at beginning of thread to emphasize wakeup + if( wakeupWidthPixels >= 3 ) + { + DrawLine( draw, ImVec2{ p1.x ,p1.y - sty * 0.75f }, ImVec2{ p1.x , p1.y + sty * 0.75f }, 0xFF000000, bgSize ); + DrawLine( draw, ImVec2{ p1.x ,p1.y - sty * 0.75f }, ImVec2{ p1.x , p1.y + sty * 0.75f }, wakecolor ); + } + } } } }