From 443771ecff8e926808d4f9617dc5274c979f0d55 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 23 Jan 2020 19:49:23 +0100 Subject: [PATCH] Only display zone "statistics" button if data is available. --- server/TracyView.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 2f81af49..0b9b8bf8 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -5707,15 +5707,25 @@ void View::DrawZoneInfoWindow() ShowZoneInfo( *parent ); } } - ImGui::SameLine(); -#ifdef TRACY_EXTENDED_FONT - if( ImGui::Button( ICON_FA_CHART_BAR " Statistics" ) ) -#else - if( ImGui::Button( "Statistics" ) ) -#endif +#ifndef TRACY_NO_STATISTICS + if( m_worker.AreSourceLocationZonesReady() ) { - m_findZone.ShowZone( ev.SrcLoc(), m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function ) ); + const auto sl = ev.SrcLoc(); + const auto& slz = m_worker.GetZonesForSourceLocation( sl ); + if( !slz.zones.empty() ) + { + ImGui::SameLine(); +#ifdef TRACY_EXTENDED_FONT + if( ImGui::Button( ICON_FA_CHART_BAR " Statistics" ) ) +#else + if( ImGui::Button( "Statistics" ) ) +#endif + { + m_findZone.ShowZone( sl, m_worker.GetString( srcloc.name.active ? srcloc.name : srcloc.function ) ); + } + } } +#endif if( ev.callstack.Val() != 0 ) { ImGui::SameLine();