From b4daad684cc201032bd932e4d586d31e0ad9a230 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 27 Feb 2019 21:12:56 +0100 Subject: [PATCH] Display frame numbers in zone trace. --- server/TracyView.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index db7656ea..6bbb6859 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3988,7 +3988,7 @@ void View::DrawInfoWindow() } template -void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, BuzzAnim& anim, View& view, bool& showUnknownFrames, std::function showZone ) +void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, BuzzAnim& anim, View& view, bool& showUnknownFrames, std::function showZone ) { bool expand = ImGui::TreeNode( "Zone trace" ); ImGui::SameLine(); @@ -3998,6 +3998,11 @@ void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, B ImGui::SameLine(); if( ImGui::SmallButton( showUnknownFrames ? "Hide unknown frames" : "Show unknown frames" ) ) showUnknownFrames = !showUnknownFrames; + int fidx = 1; + TextDisabledUnformatted( "0." ); + ImGui::SameLine(); + TextDisabledUnformatted( "[this zone]" ); + if( !trace.empty() ) { T prev = zone; @@ -4009,6 +4014,8 @@ void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, B { if( showUnknownFrames ) { + ImGui::TextDisabled( "%i.", fidx++ ); + ImGui::SameLine(); TextDisabledUnformatted( "[unknown frames]" ); } } @@ -4038,6 +4045,8 @@ void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, B { auto frameData = worker.GetCallstackFrame( prevCs[j] ); auto frame = frameData->data + frameData->size - 1; + ImGui::TextDisabled( "%i.", fidx++ ); + ImGui::SameLine(); TextDisabledUnformatted( worker.GetString( frame->name ) ); ImGui::SameLine(); ImGui::Spacing(); @@ -4074,7 +4083,7 @@ void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, B } } - showZone( curr ); + showZone( curr, fidx ); prev = curr; } } @@ -4084,6 +4093,8 @@ void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, B { if( showUnknownFrames ) { + ImGui::TextDisabled( "%i.", fidx++ ); + ImGui::SameLine(); TextDisabledUnformatted( "[unknown frames]" ); } } @@ -4095,6 +4106,8 @@ void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, B { auto frameData = worker.GetCallstackFrame( cs[i] ); auto frame = frameData->data + frameData->size - 1; + ImGui::TextDisabled( "%i.", fidx++ ); + ImGui::SameLine(); TextDisabledUnformatted( worker.GetString( frame->name ) ); ImGui::SameLine(); ImGui::Spacing(); @@ -4384,7 +4397,9 @@ void View::DrawZoneInfoWindow() parent = GetZoneParent( *parent ); } int idx = 0; - DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const ZoneEvent* v ) { + DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const ZoneEvent* v, int& fidx ) { + ImGui::TextDisabled( "%i.", fidx++ ); + ImGui::SameLine(); const auto& srcloc = m_worker.GetSourceLocation( v->srcloc ); const auto txt = m_worker.GetZoneName( *v, srcloc ); ImGui::PushID( idx++ ); @@ -4784,7 +4799,9 @@ void View::DrawGpuInfoWindow() parent = GetZoneParent( *parent ); } int idx = 0; - DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const GpuEvent* v ) { + DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const GpuEvent* v, int& fidx ) { + ImGui::TextDisabled( "%i.", fidx++ ); + ImGui::SameLine(); const auto& srcloc = m_worker.GetSourceLocation( v->srcloc ); const auto txt = m_worker.GetZoneName( *v, srcloc ); ImGui::PushID( idx++ );