mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Merge pull request #557 from KristofferC/kc/filter_user
allow filtering zones in Zone finder based on the user text
This commit is contained in:
commit
c75f01c90e
@ -458,6 +458,8 @@ private:
|
||||
|
||||
ImGuiTextFilter m_statisticsFilter;
|
||||
ImGuiTextFilter m_statisticsImageFilter;
|
||||
ImGuiTextFilter m_userTextFilter;
|
||||
unordered_flat_set<Worker::ZoneThreadData*> m_filteredZones;
|
||||
|
||||
Region m_highlight;
|
||||
Region m_highlightZoom;
|
||||
|
@ -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; i<m_findZone.sortedNum; i++ )
|
||||
{
|
||||
auto& ev = zones[i];
|
||||
if( m_filteredZones.contains( &ev ) ) continue;
|
||||
if( selGroup == GetSelectionTarget( ev, groupBy ) )
|
||||
{
|
||||
const auto ctx = m_worker.GetContextSwitchData( m_worker.DecompressThread( zones[i].Thread() ) );
|
||||
@ -581,6 +583,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() - GetZoneChildTimeFast( *ev.Zone() );
|
||||
@ -595,6 +598,7 @@ void View::DrawFindZone()
|
||||
for( size_t i=m_findZone.selSortNum; i<m_findZone.sortedNum; i++ )
|
||||
{
|
||||
auto& ev = zones[i];
|
||||
if( m_filteredZones.contains( &ev ) ) continue;
|
||||
if( selGroup == GetSelectionTarget( ev, groupBy ) )
|
||||
{
|
||||
const auto t = ev.Zone()->End() - 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; i<m_findZone.sortedNum; i++ )
|
||||
{
|
||||
auto& ev = zones[i];
|
||||
if( m_filteredZones.contains( &ev ) ) continue;
|
||||
if( selGroup == GetSelectionTarget( ev, groupBy ) )
|
||||
{
|
||||
const auto t = ev.Zone()->End() - 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 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user