From 83b7d3a2671bef4657dfa2898e7f84c2af422e2a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 16 Mar 2026 01:42:29 +0100 Subject: [PATCH] Simplify "zone trace" into "parent zones". --- profiler/src/profiler/TracyView.cpp | 1 - profiler/src/profiler/TracyView.hpp | 1 - profiler/src/profiler/TracyView_ZoneInfo.cpp | 143 +------------------ 3 files changed, 5 insertions(+), 140 deletions(-) diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index cff341d4..0f1bf7b0 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -111,7 +111,6 @@ View::View( void(*cbMainThread)(const std::function&, bool), FileRead& f m_userData.LoadAnnotations( m_annotations ); m_sourceRegexValid = m_userData.LoadSourceSubstitutions( m_sourceSubstitutions ); - if( m_worker.GetCallstackFrameCount() == 0 ) m_showUnknownFrames = false; if( m_worker.GetCallstackSampleCount() == 0 ) m_showAllSymbols = true; Achieve( "loadTrace" ); diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index 00cfb453..11cdac64 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -581,7 +581,6 @@ private: bool m_showAllSymbols = false; int m_showCallstackFrameAddress = 0; bool m_showExternalFrames = false; - bool m_showUnknownFrames = true; bool m_statSeparateInlines = false; bool m_mergeInlines = false; bool m_relativeInlines = false; diff --git a/profiler/src/profiler/TracyView_ZoneInfo.cpp b/profiler/src/profiler/TracyView_ZoneInfo.cpp index 560e35e1..d13c5cbd 100644 --- a/profiler/src/profiler/TracyView_ZoneInfo.cpp +++ b/profiler/src/profiler/TracyView_ZoneInfo.cpp @@ -127,152 +127,19 @@ void View::CalcZoneTimeDataImpl( const V& children, const ContextSwitch* ctx, un } template -void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, BuzzAnim& anim, View& view, bool& showUnknownFrames, std::function showZone ) +void DrawZoneTrace( const std::vector& trace, const std::function& showZone ) { - bool expand = ImGui::TreeNode( "Zone trace" ); + bool expand = ImGui::TreeNode( "Parent zones" ); ImGui::SameLine(); ImGui::TextDisabled( "(%s)", RealToString( trace.size() ) ); if( !expand ) return; - const auto shortenName = view.GetShortenName(); - - ImGui::SameLine(); - SmallCheckbox( "Show unknown frames", &showUnknownFrames ); - int fidx = 1; TextDisabledUnformatted( "0." ); ImGui::SameLine(); TextDisabledUnformatted( "[this zone]" ); - if( !trace.empty() ) - { - T prev = zone; - const auto sz = trace.size(); - for( size_t i=0; idata + frameData->size - 1; - ImGui::TextDisabled( "%i.", fidx++ ); - ImGui::SameLine(); - const auto frameName = worker.GetString( frame->name ); - const auto normalized = shortenName != ShortenName::Never ? ShortenZoneName( ShortenName::OnlyNormalize, frameName ) : frameName; - TextDisabledUnformatted( normalized ); - TooltipNormalizedName( frameName, normalized ); - ImGui::SameLine(); - ImGui::Spacing(); - if( anim.Match( frame ) ) - { - const auto time = anim.Time(); - const auto indentVal = sin( time * 60.f ) * 10.f * time; - ImGui::SameLine( 0, ImGui::GetStyle().ItemSpacing.x + indentVal ); - s_wasActive = true; - } - else - { - ImGui::SameLine(); - } - const auto fileName = worker.GetString( frame->file ); - TextDisabledUnformatted( LocationToString( fileName, frame->line ) ); - if( ImGui::IsItemClicked( 1 ) ) - { - if( !view.ViewDispatch( fileName, frame->line, frame->symAddr ) ) - { - anim.Enable( frame, 0.5f ); - } - } - } - } - - showZone( curr, fidx ); - prev = curr; - } - } - - auto last = trace.empty() ? zone : trace.back(); - const auto lcv = GetZoneCallstack( *last, worker ); - if( lcv == 0 ) - { - if( showUnknownFrames ) - { - ImGui::TextDisabled( "%i.", fidx++ ); - ImGui::SameLine(); - TextDisabledUnformatted( "[unknown frames]" ); - } - } - else - { - auto& cs = worker.GetCallstack( lcv ); - const auto csz = cs.size(); - for( uint16_t i=1; idata + frameData->size - 1; - ImGui::TextDisabled( "%i.", fidx++ ); - ImGui::SameLine(); - const auto frameName = worker.GetString( frame->name ); - const auto normalized = shortenName != ShortenName::Never ? ShortenZoneName( ShortenName::OnlyNormalize, frameName ) : frameName; - TextDisabledUnformatted( normalized ); - TooltipNormalizedName( frameName, normalized ); - ImGui::SameLine(); - ImGui::Spacing(); - if( anim.Match( frame ) ) - { - const auto time = anim.Time(); - const auto indentVal = sin( time * 60.f ) * 10.f * time; - ImGui::SameLine( 0, ImGui::GetStyle().ItemSpacing.x + indentVal ); - s_wasActive = true; - } - else - { - ImGui::SameLine(); - } - const auto fileName = worker.GetString( frame->file ); - TextDisabledUnformatted( LocationToString( fileName, frame->line ) ); - if( ImGui::IsItemClicked( 1 ) ) - { - if( !view.ViewDispatch( fileName, frame->line, frame->symAddr ) ) - { - anim.Enable( frame, 0.5f ); - } - } - } - } + for( auto& v : trace ) showZone( v, fidx ); ImGui::TreePop(); } @@ -1010,7 +877,7 @@ void View::DrawZoneInfoWindow() parent = GetZoneParent( *parent ); } int idx = 0; - DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const ZoneEvent* v, int& fidx ) { + DrawZoneTrace( zoneTrace, [&idx, this] ( const ZoneEvent* v, int& fidx ) { ImGui::TextDisabled( "%i.", fidx++ ); ImGui::SameLine(); const auto& srcloc = m_worker.GetSourceLocation( v->SrcLoc() ); @@ -1587,7 +1454,7 @@ void View::DrawGpuInfoWindow() parent = GetZoneParent( *parent ); } int idx = 0; - DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const GpuEvent* v, int& fidx ) { + DrawZoneTrace( zoneTrace, [&idx, this] ( const GpuEvent* v, int& fidx ) { ImGui::TextDisabled( "%i.", fidx++ ); ImGui::SameLine(); const auto& srcloc = m_worker.GetSourceLocation( v->SrcLoc() );