diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 0add1ebd..96b11b73 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -10073,20 +10073,40 @@ void View::DrawStatistics() return; } + m_statisticsFilter.Draw( "Filter zones", 200 ); + ImGui::SameLine(); #ifdef TRACY_EXTENDED_FONT - ImGui::Checkbox( ICON_FA_CLOCK " Show self times", &m_statSelf ); + if( ImGui::Button( ICON_FA_BAN " Clear" ) ) #else - ImGui::Checkbox( "Show self times", &m_statSelf ); + if( ImGui::Button( "Clear" ) ) #endif + { + m_statisticsFilter.Clear(); + } + const auto filterActive = m_statisticsFilter.IsActive(); auto& slz = m_worker.GetSourceLocationZones(); Vector srcloc; srcloc.reserve( slz.size() ); + uint32_t slzcnt = 0; for( auto it = slz.begin(); it != slz.end(); ++it ) { if( it->second.total != 0 ) { - srcloc.push_back_no_space_check( it ); + slzcnt++; + if( !filterActive ) + { + srcloc.push_back_no_space_check( it ); + } + else + { + auto& sl = m_worker.GetSourceLocation( it->first ); + auto name = m_worker.GetString( sl.name.active ? sl.name : sl.function ); + if( m_statisticsFilter.PassFilter( name ) ) + { + srcloc.push_back_no_space_check( it ); + } + } } } @@ -10120,10 +10140,25 @@ void View::DrawStatistics() break; } - TextFocused( "Recorded source locations:", RealToString( srcloc.size(), true ) ); + ImGui::SameLine(); + ImGui::Spacing(); + ImGui::SameLine(); + TextFocused( "Total zone count:", RealToString( slzcnt, true ) ); + ImGui::SameLine(); + ImGui::Spacing(); + ImGui::SameLine(); + TextFocused( "Visible zones:", RealToString( srcloc.size(), true ) ); + ImGui::SameLine(); + ImGui::Spacing(); + ImGui::SameLine(); +#ifdef TRACY_EXTENDED_FONT + ImGui::Checkbox( ICON_FA_CLOCK " Show self times", &m_statSelf ); +#else + ImGui::Checkbox( "Show self times", &m_statSelf ); +#endif ImGui::Separator(); - ImGui::BeginChild( "##messages" ); + ImGui::BeginChild( "##statistics" ); const auto w = ImGui::GetWindowWidth(); static bool widthSet = false; ImGui::Columns( 5 ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 8bf5bd25..2c22d1b0 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -287,6 +287,7 @@ private: int m_frameHover = -1; bool m_messagesScrollBottom; ImGuiTextFilter m_messageFilter; + ImGuiTextFilter m_statisticsFilter; int m_visibleMessages = 0; bool m_disconnectIssued = false; DecayValue m_drawThreadMigrations = 0;