diff --git a/server/TracyView.hpp b/server/TracyView.hpp index f8f8d0f1..3a78367b 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -458,6 +458,8 @@ private: ImGuiTextFilter m_statisticsFilter; ImGuiTextFilter m_statisticsImageFilter; + ImGuiTextFilter m_userTextFilter; + unordered_flat_set m_filteredZones; Region m_highlight; Region m_highlightZoom; diff --git a/server/TracyView_FindZone.cpp b/server/TracyView_FindZone.cpp index 7de5f561..1fadb376 100644 --- a/server/TracyView_FindZone.cpp +++ b/server/TracyView_FindZone.cpp @@ -543,6 +543,7 @@ void View::DrawFindZone() { auto& ev = zones[i]; if( ev.Zone()->End() > rangeMax || ev.Zone()->Start() < rangeMin ) continue; + if( m_filteredZones.contains( &ev ) ) continue; if( selGroup == GetSelectionTarget( ev, groupBy ) ) { const auto ctx = m_worker.GetContextSwitchData( m_worker.DecompressThread( zones[i].Thread() ) ); @@ -560,6 +561,7 @@ void View::DrawFindZone() for( size_t i=m_findZone.selSortNum; iEnd() > rangeMax || ev.Zone()->Start() < rangeMin ) continue; + if( m_filteredZones.contains( &ev ) ) continue; if( selGroup == GetSelectionTarget( ev, groupBy ) ) { const auto t = ev.Zone()->End() - ev.Zone()->Start() - GetZoneChildTimeFast( *ev.Zone() ); @@ -595,6 +598,7 @@ void View::DrawFindZone() for( size_t i=m_findZone.selSortNum; iEnd() - ev.Zone()->Start() - GetZoneChildTimeFast( *ev.Zone() ); @@ -613,6 +617,7 @@ void View::DrawFindZone() { auto& ev = zones[i]; if( ev.Zone()->End() > rangeMax || ev.Zone()->Start() < rangeMin ) continue; + if( m_filteredZones.contains( &ev ) ) continue; if( selGroup == GetSelectionTarget( ev, groupBy ) ) { const auto t = ev.Zone()->End() - ev.Zone()->Start(); @@ -627,6 +632,7 @@ void View::DrawFindZone() for( size_t i=m_findZone.selSortNum; iEnd() - ev.Zone()->Start(); @@ -1362,6 +1368,24 @@ void View::DrawFindZone() SmallCheckbox( "Show zone time in frames", &m_findZone.showZoneInFrames ); ImGui::Separator(); + ImGui::AlignTextToFramePadding(); + TextDisabledUnformatted( "Filter user text:" ); + ImGui::SameLine(); + bool filterChanged = m_userTextFilter.Draw( ICON_FA_FILTER "###resultFilter", 200 ); + + ImGui::SameLine(); + if( ImGui::Button( ICON_FA_DELETE_LEFT " Clear###userText" ) ) + { + m_userTextFilter.Clear(); + filterChanged = true; + } + ImGui::Separator(); + if( filterChanged ) + { + m_filteredZones.clear(); + m_findZone.ResetGroups(); + } + ImGui::TextUnformatted( "Found zones:" ); ImGui::SameLine(); DrawHelpMarker( "Left click to highlight entry." ); @@ -1429,6 +1453,26 @@ void View::DrawFindZone() zptr++; continue; } + + if( m_userTextFilter.IsActive() ) + { + bool keep = false; + if ( m_worker.HasZoneExtra( *ev.Zone() ) && m_worker.GetZoneExtra( *ev.Zone() ).text.Active() ) + { + auto text = m_worker.GetString( m_worker.GetZoneExtra( *ev.Zone() ).text ); + if( m_userTextFilter.PassFilter( text ) ) + { + keep = true; + } + } + if( !keep ) + { + m_filteredZones.insert( &ev ); + zptr++; + continue; + } + } + auto timespan = end - start; assert( timespan != 0 ); if( m_findZone.selfTime )