1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-01 13:13:53 +00:00
This commit is contained in:
Bartosz Taudul 2018-02-15 16:24:01 +01:00
parent d1d54db7b6
commit cc38988045

View File

@ -4146,8 +4146,7 @@ void View::DrawFindZone()
ImGui::InputText( "", m_findZone.pattern, 1024 ); ImGui::InputText( "", m_findZone.pattern, 1024 );
ImGui::SameLine(); ImGui::SameLine();
bool findClicked = ImGui::Button( "Find" ); const bool findClicked = ImGui::Button( "Find" );
ImGui::SameLine(); ImGui::SameLine();
if( ImGui::Button( "Clear" ) ) if( ImGui::Button( "Clear" ) )
@ -4166,7 +4165,7 @@ void View::DrawFindZone()
ImGui::TreePop(); ImGui::TreePop();
} }
if ( findClicked ) if( findClicked )
{ {
m_findZone.result.clear(); m_findZone.result.clear();
FindZones(); FindZones();
@ -4192,13 +4191,15 @@ void View::DrawFindZone()
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Separator(); ImGui::Separator();
for( auto ev : v->timeline ) for( auto& ev : v->timeline )
{ {
ImGui::PushID( ev ); ImGui::PushID( ev );
auto& srcloc = GetSourceLocation( ev->srcloc ); auto& srcloc = GetSourceLocation( ev->srcloc );
if( ImGui::Selectable( GetString( srcloc.name.active ? srcloc.name : srcloc.function ), m_zoneInfoWindow == ev, ImGuiSelectableFlags_SpanAllColumns ) ) if( ImGui::Selectable( GetString( srcloc.name.active ? srcloc.name : srcloc.function ), m_zoneInfoWindow == ev, ImGuiSelectableFlags_SpanAllColumns ) )
{
m_zoneInfoWindow = ev; m_zoneInfoWindow = ev;
}
ImGui::NextColumn(); ImGui::NextColumn();
@ -4454,12 +4455,12 @@ const GpuEvent* View::GetZoneParent( const GpuEvent& zone ) const
void View::FindZones() void View::FindZones()
{ {
for( auto v : m_threads ) for( auto& v : m_threads )
{ {
auto thrOut = std::make_unique<ThreadData>(); auto thrOut = std::make_unique<ThreadData>();
FindZones( v->timeline, thrOut->timeline, m_findZone.maxDepth ); FindZones( v->timeline, thrOut->timeline, m_findZone.maxDepth );
if ( thrOut->timeline.size() ) if( !thrOut->timeline.empty() )
{ {
thrOut->id = v->id; thrOut->id = v->id;
m_findZone.result.push_back( std::move( thrOut ) ); m_findZone.result.push_back( std::move( thrOut ) );
@ -4467,20 +4468,24 @@ void View::FindZones()
} }
} }
void View::FindZones( const Vector<ZoneEvent*> &events, Vector<ZoneEvent*> &out, const int maxdepth ) void View::FindZones( const Vector<ZoneEvent*>& events, Vector<ZoneEvent*>& out, const int maxdepth )
{ {
for ( ZoneEvent *ev : events ) for( auto& ev : events )
{ {
if ( out.size() >= m_findZone.maxZonesPerThread ) if( out.size() >= m_findZone.maxZonesPerThread ) break;
break;
auto& srcloc = GetSourceLocation( ev->srcloc ); auto& srcloc = GetSourceLocation( ev->srcloc );
const auto str = GetString( srcloc.name.active ? srcloc.name : srcloc.function ); auto str = GetString( srcloc.name.active ? srcloc.name : srcloc.function );
if ( strstr( str, m_findZone.pattern ) ) if( strstr( str, m_findZone.pattern ) != nullptr )
{
out.push_back( ev ); out.push_back( ev );
}
if ( maxdepth != 0 ) FindZones( ev->child, out, maxdepth - 1 ); if( maxdepth != 0 )
{
FindZones( ev->child, out, maxdepth - 1 );
}
} }
} }