From 50a1faa88037d2a66540ad99ac7b30ec624a8a28 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 18 Apr 2021 20:16:05 +0200 Subject: [PATCH] Don't print zero sample counts in tooltips. --- server/TracySourceView.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index c088fb58..c9a02ad5 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -1153,8 +1153,8 @@ void SourceView::RenderSymbolView( const Worker& worker, View& view ) if( ImGui::IsItemHovered() ) { ImGui::BeginTooltip(); - TextFocused( "Local time:", TimeToString( iptotalAsm.local * worker.GetSamplingPeriod() ) ); - TextFocused( "Child time:", TimeToString( iptotalAsm.ext * worker.GetSamplingPeriod() ) ); + if( iptotalAsm.local != 0 ) TextFocused( "Local time:", TimeToString( iptotalAsm.local * worker.GetSamplingPeriod() ) ); + if( iptotalAsm.ext != 0 ) TextFocused( "Child time:", TimeToString( iptotalAsm.ext * worker.GetSamplingPeriod() ) ); ImGui::EndTooltip(); } ImGui::SameLine(); @@ -1171,8 +1171,8 @@ void SourceView::RenderSymbolView( const Worker& worker, View& view ) if( ImGui::IsItemHovered() ) { ImGui::BeginTooltip(); - TextFocused( "Local samples:", RealToString( iptotalAsm.local ) ); - TextFocused( "Child samples:", RealToString( iptotalAsm.ext ) ); + if( iptotalAsm.local != 0 ) TextFocused( "Local samples:", RealToString( iptotalAsm.local ) ); + if( iptotalAsm.ext != 0 ) TextFocused( "Child samples:", RealToString( iptotalAsm.ext ) ); ImGui::EndTooltip(); } ImGui::SameLine(); @@ -1434,10 +1434,10 @@ void SourceView::RenderSymbolSourceView( uint32_t iptotal, const unordered_flat_ if( ImGui::IsItemHovered() ) { ImGui::BeginTooltip(); - TextFocused( "Local time:", TimeToString( fit->second.local * worker.GetSamplingPeriod() ) ); - TextFocused( "Child time:", TimeToString( fit->second.ext * worker.GetSamplingPeriod() ) ); - TextFocused( "Local samples:", RealToString( fit->second.local ) ); - TextFocused( "Child samples:", RealToString( fit->second.ext ) ); + if( fit->second.local ) TextFocused( "Local time:", TimeToString( fit->second.local * worker.GetSamplingPeriod() ) ); + if( fit->second.ext ) TextFocused( "Child time:", TimeToString( fit->second.ext * worker.GetSamplingPeriod() ) ); + if( fit->second.local ) TextFocused( "Local samples:", RealToString( fit->second.local ) ); + if( fit->second.ext ) TextFocused( "Child samples:", RealToString( fit->second.ext ) ); ImGui::EndTooltip(); } ImGui::SameLine();