From 45b9aff761b017cfab07deb60dbe413dca28ed4c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 8 Sep 2024 17:44:42 +0200 Subject: [PATCH] Display counts of selectable items, if some are unselected. --- .../src/profiler/TracyView_ContextSwitch.cpp | 11 ++- profiler/src/profiler/TracyView_Messages.cpp | 20 ++++- profiler/src/profiler/TracyView_Options.cpp | 88 +++++++++++++++++-- 3 files changed, 106 insertions(+), 13 deletions(-) diff --git a/profiler/src/profiler/TracyView_ContextSwitch.cpp b/profiler/src/profiler/TracyView_ContextSwitch.cpp index 728ab2c1..d6334eab 100644 --- a/profiler/src/profiler/TracyView_ContextSwitch.cpp +++ b/profiler/src/profiler/TracyView_ContextSwitch.cpp @@ -440,7 +440,16 @@ void View::DrawWaitStacks() bool threadsChanged = false; auto expand = ImGui::TreeNode( ICON_FA_SHUFFLE " Visible threads:" ); ImGui::SameLine(); - ImGui::TextDisabled( "(%zu)", m_threadOrder.size() ); + size_t visibleThreads = 0; + for( const auto& t : m_threadOrder ) if( WaitStackThread( t->id ) ) visibleThreads++; + if( visibleThreads == m_threadOrder.size() ) + { + ImGui::TextDisabled( "(%zu)", m_threadOrder.size() ); + } + else + { + ImGui::TextDisabled( "(%zi/%zu)", visibleThreads, m_threadOrder.size() ); + } if( expand ) { auto& crash = m_worker.GetCrashEvent(); diff --git a/profiler/src/profiler/TracyView_Messages.cpp b/profiler/src/profiler/TracyView_Messages.cpp index 9e18b808..ed63b8fe 100644 --- a/profiler/src/profiler/TracyView_Messages.cpp +++ b/profiler/src/profiler/TracyView_Messages.cpp @@ -22,9 +22,6 @@ void View::DrawMessages() return; } - size_t tsz = 0; - for( const auto& t : m_threadOrder ) if( !t->messages.empty() ) tsz++; - bool filterChanged = m_messageFilter.Draw( ICON_FA_FILTER " Filter messages", 200 ); ImGui::SameLine(); if( ImGui::Button( ICON_FA_DELETE_LEFT " Clear" ) ) @@ -51,7 +48,22 @@ void View::DrawMessages() bool threadsChanged = false; auto expand = ImGui::TreeNode( ICON_FA_SHUFFLE " Visible threads:" ); ImGui::SameLine(); - ImGui::TextDisabled( "(%zu)", tsz ); + size_t visibleThreads = 0; + size_t tsz = 0; + for( const auto& t : m_threadOrder ) + { + if( t->messages.empty() ) continue; + if( VisibleMsgThread( t->id ) ) visibleThreads++; + tsz++; + } + if( visibleThreads == tsz ) + { + ImGui::TextDisabled( "(%zu)", tsz ); + } + else + { + ImGui::TextDisabled( "(%zu/%zu)", visibleThreads, tsz ); + } if( expand ) { auto& crash = m_worker.GetCrashEvent(); diff --git a/profiler/src/profiler/TracyView_Options.cpp b/profiler/src/profiler/TracyView_Options.cpp index 813ddcb7..6a7f7ad3 100644 --- a/profiler/src/profiler/TracyView_Options.cpp +++ b/profiler/src/profiler/TracyView_Options.cpp @@ -89,7 +89,16 @@ void View::DrawOptions() m_vd.drawGpuZones = val; const auto expand = ImGui::TreeNode( "GPU zones" ); ImGui::SameLine(); - ImGui::TextDisabled( "(%zu)", gpuData.size() ); + size_t visibleGpu = 0; + for( const auto& gd : gpuData ) if( m_tc.GetItem( gd ).IsVisible() ) visibleGpu++; + if( visibleGpu == gpuData.size() ) + { + ImGui::TextDisabled( "(%zu)", gpuData.size() ); + } + else + { + ImGui::TextDisabled( "(%zu/%zu)", visibleGpu, gpuData.size() ); + } if( expand ) { for( size_t i=0; ithreadList.size() != 1 && l.second->isContended && Vis( l.second ) ) visibleMultiCntCont++; + if( visibleMultiCntCont == multiCntCont ) + { + ImGui::TextDisabled( "(%zu)", multiCntCont ); + } + else + { + ImGui::TextDisabled( "(%zu/%zu)", visibleMultiCntCont, multiCntCont ); + } if( multiExpand ) { ImGui::SameLine(); @@ -377,7 +404,16 @@ void View::DrawOptions() } const bool multiUncontExpand = ImGui::TreeNodeEx( "Uncontended locks present in multiple threads", 0 ); ImGui::SameLine(); - ImGui::TextDisabled( "(%zu)", multiCntUncont ); + uint64_t visibleMultiCntUncont = 0; + for( const auto& l : m_worker.GetLockMap() ) if( l.second->threadList.size() != 1 && !l.second->isContended && Vis( l.second ) ) visibleMultiCntUncont++; + if( visibleMultiCntUncont == multiCntUncont ) + { + ImGui::TextDisabled( "(%zu)", multiCntUncont ); + } + else + { + ImGui::TextDisabled( "(%zu/%zu)", visibleMultiCntUncont, multiCntUncont ); + } if( multiUncontExpand ) { ImGui::SameLine(); @@ -455,7 +491,16 @@ void View::DrawOptions() } const auto singleExpand = ImGui::TreeNodeEx( "Locks present in a single thread", 0 ); ImGui::SameLine(); - ImGui::TextDisabled( "(%zu)", singleCnt ); + uint64_t visibleSingleCnt = 0; + for( const auto& l : m_worker.GetLockMap() ) if( l.second->threadList.size() == 1 && Vis( l.second ) ) visibleSingleCnt++; + if( visibleSingleCnt == singleCnt ) + { + ImGui::TextDisabled( "(%zu)", singleCnt ); + } + else + { + ImGui::TextDisabled( "(%zu/%zu)", visibleSingleCnt, singleCnt ); + } if( singleExpand ) { ImGui::SameLine(); @@ -549,7 +594,16 @@ void View::DrawOptions() const auto expand = ImGui::TreeNode( "Plots" ); ImGui::SameLine(); - ImGui::TextDisabled( "(%zu)", m_worker.GetPlots().size() ); + size_t visiblePlots = 0; + for( const auto& p : m_worker.GetPlots() ) if( m_tc.GetItem( p ).IsVisible() ) visiblePlots++; + if( visiblePlots == m_worker.GetPlots().size() ) + { + ImGui::TextDisabled( "(%zu)", m_worker.GetPlots().size() ); + } + else + { + ImGui::TextDisabled( "(%zu/%zu)", visiblePlots, m_worker.GetPlots().size() ); + } if( expand ) { ImGui::SameLine(); @@ -584,7 +638,16 @@ void View::DrawOptions() ImGui::Separator(); auto expand = ImGui::TreeNode( ICON_FA_SHUFFLE " Visible threads:" ); ImGui::SameLine(); - ImGui::TextDisabled( "(%zu)", m_threadOrder.size() ); + size_t visibleThreads = 0; + for( const auto& t : m_threadOrder ) if( m_tc.GetItem( t ).IsVisible() ) visibleThreads++; + if( visibleThreads == m_threadOrder.size() ) + { + ImGui::TextDisabled( "(%zu)", m_threadOrder.size() ); + } + else + { + ImGui::TextDisabled( "(%zu/%zu)", visibleThreads, m_threadOrder.size() ); + } if( expand ) { auto& crash = m_worker.GetCrashEvent(); @@ -715,7 +778,16 @@ void View::DrawOptions() ImGui::Separator(); expand = ImGui::TreeNode( ICON_FA_IMAGES " Visible frame sets:" ); ImGui::SameLine(); - ImGui::TextDisabled( "(%zu)", m_worker.GetFrames().size() ); + uint64_t visibleFrames = 0; + for( const auto& fd : m_worker.GetFrames() ) if( Vis( fd ) ) visibleFrames++; + if( visibleFrames == m_worker.GetFrames().size() ) + { + ImGui::TextDisabled( "(%zu)", m_worker.GetFrames().size() ); + } + else + { + ImGui::TextDisabled( "(%zu/%zu)", visibleFrames, m_worker.GetFrames().size() ); + } if( expand ) { ImGui::SameLine();