From cd8d86edf3e985a728e385d4ca1baf344917edfa Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 21 Dec 2018 21:10:29 +0100 Subject: [PATCH] Allow hiding "[unknown frames]" entries. --- server/TracyView.cpp | 21 ++++++++++++++++----- server/TracyView.hpp | 1 + 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 812757b6..2bf37ff2 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -325,6 +325,7 @@ View::View( const char* addr, ImFont* fixedWidth, SetTitleCallback stcb ) , m_statSort( 0 ) , m_statSelf( false ) , m_showCallstackFrameAddress( false ) + , m_showUnknownFrames( true ) , m_namespace( Namespace::Full ) , m_textEditorFont( fixedWidth ) , m_stcb( stcb ) @@ -373,6 +374,7 @@ View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb ) , m_statSort( 0 ) , m_statSelf( false ) , m_showCallstackFrameAddress( false ) + , m_showUnknownFrames( true ) , m_namespace( Namespace::Full ) , m_textEditorFont( fixedWidth ) , m_stcb( stcb ) @@ -3566,13 +3568,16 @@ void View::DrawInfoWindow() } template -void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, BuzzAnim& anim, View& view, 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(); ImGui::TextDisabled( "(%s)", RealToString( trace.size(), true ) ); if( !expand ) return; + ImGui::SameLine(); + if( ImGui::SmallButton( showUnknownFrames ? "Hide unknown frames" : "Show unknown frames" ) ) showUnknownFrames = !showUnknownFrames; + if( !trace.empty() ) { T prev = zone; @@ -3582,7 +3587,10 @@ void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, B auto curr = trace[i]; if( prev->callstack == 0 || curr->callstack == 0 ) { - ImGui::TextDisabled( "[unknown frames]" ); + if( showUnknownFrames ) + { + ImGui::TextDisabled( "[unknown frames]" ); + } } else if( prev->callstack != curr->callstack ) { @@ -3653,7 +3661,10 @@ void DrawZoneTrace( T zone, const std::vector& trace, const Worker& worker, B auto last = trace.empty() ? zone : trace.back(); if( last->callstack == 0 ) { - ImGui::TextDisabled( "[unknown frames]" ); + if( showUnknownFrames ) + { + ImGui::TextDisabled( "[unknown frames]" ); + } } else { @@ -3953,7 +3964,7 @@ void View::DrawZoneInfoWindow() parent = GetZoneParent( *parent ); } int idx = 0; - DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, [&idx, this] ( const ZoneEvent* v ) { + DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const ZoneEvent* v ) { const auto& srcloc = m_worker.GetSourceLocation( v->srcloc ); const auto txt = m_worker.GetZoneName( *v, srcloc ); ImGui::PushID( idx++ ); @@ -4200,7 +4211,7 @@ void View::DrawGpuInfoWindow() parent = GetZoneParent( *parent ); } int idx = 0; - DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, [&idx, this] ( const GpuEvent* v ) { + DrawZoneTrace( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const GpuEvent* v ) { const auto& srcloc = m_worker.GetSourceLocation( v->srcloc ); const auto txt = m_worker.GetZoneName( *v, srcloc ); ImGui::PushID( idx++ ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index e013adcb..b65eb4c2 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -254,6 +254,7 @@ private: int m_statSort; bool m_statSelf; bool m_showCallstackFrameAddress; + bool m_showUnknownFrames; Namespace m_namespace; Animation m_zoomAnim;