Clip found zones list.

This commit is contained in:
Bartosz Taudul 2020-01-31 19:07:20 +01:00
parent f86fbe7fd5
commit a84eec1aef

View File

@ -9573,53 +9573,58 @@ void View::DrawZoneList( const Vector<short_ptr<ZoneEvent>>& zones )
} }
} }
for( auto& ev : *zonesToIterate ) ImGuiListClipper clipper( zonesToIterate->size() );
while( clipper.Step() )
{ {
const auto end = m_worker.GetZoneEndDirect( *ev ); for( auto i=clipper.DisplayStart; i<clipper.DisplayEnd; i++ )
int64_t timespan;
if( m_findZone.runningTime )
{ {
const auto ctx = m_worker.GetContextSwitchData( GetZoneThread( *ev ) ); auto ev = (*zonesToIterate)[i].get();
uint64_t cnt; const auto end = m_worker.GetZoneEndDirect( *ev );
GetZoneRunningTime( ctx, *ev, timespan, cnt ); int64_t timespan;
} if( m_findZone.runningTime )
else
{
timespan = end - ev->Start();
if( m_findZone.selfTime ) timespan -= GetZoneChildTimeFast( *ev );
}
ImGui::PushID( ev );
if( m_zoneHover == ev ) ImGui::PushStyleColor( ImGuiCol_Text, ImVec4( 0, 1, 0, 1 ) );
if( ImGui::Selectable( TimeToString( ev->Start() ), m_zoneInfoWindow == ev, ImGuiSelectableFlags_SpanAllColumns ) )
{
ShowZoneInfo( *ev );
}
if( ImGui::IsItemHovered() )
{
m_zoneHighlight = ev;
if( ImGui::IsMouseClicked( 2 ) )
{ {
ZoomToZone( *ev ); const auto ctx = m_worker.GetContextSwitchData( GetZoneThread( *ev ) );
uint64_t cnt;
GetZoneRunningTime( ctx, *ev, timespan, cnt );
} }
ZoneTooltip( *ev ); else
m_zoneHover2 = ev;
}
ImGui::NextColumn();
ImGui::TextUnformatted( TimeToString( timespan ) );
ImGui::NextColumn();
if( m_worker.HasZoneExtra( *ev ) )
{
const auto& extra = m_worker.GetZoneExtra( *ev );
if( extra.name.Active() )
{ {
ImGui::TextUnformatted( m_worker.GetString( extra.name ) ); timespan = end - ev->Start();
if( m_findZone.selfTime ) timespan -= GetZoneChildTimeFast( *ev );
} }
ImGui::PushID( ev );
if( m_zoneHover == ev ) ImGui::PushStyleColor( ImGuiCol_Text, ImVec4( 0, 1, 0, 1 ) );
if( ImGui::Selectable( TimeToString( ev->Start() ), m_zoneInfoWindow == ev, ImGuiSelectableFlags_SpanAllColumns ) )
{
ShowZoneInfo( *ev );
}
if( ImGui::IsItemHovered() )
{
m_zoneHighlight = ev;
if( ImGui::IsMouseClicked( 2 ) )
{
ZoomToZone( *ev );
}
ZoneTooltip( *ev );
m_zoneHover2 = ev;
}
ImGui::NextColumn();
ImGui::TextUnformatted( TimeToString( timespan ) );
ImGui::NextColumn();
if( m_worker.HasZoneExtra( *ev ) )
{
const auto& extra = m_worker.GetZoneExtra( *ev );
if( extra.name.Active() )
{
ImGui::TextUnformatted( m_worker.GetString( extra.name ) );
}
}
ImGui::NextColumn();
if( m_zoneHover == ev ) ImGui::PopStyleColor();
ImGui::PopID();
} }
ImGui::NextColumn();
if( m_zoneHover == ev ) ImGui::PopStyleColor();
ImGui::PopID();
} }
ImGui::Columns( 1 ); ImGui::Columns( 1 );
ImGui::Separator(); ImGui::Separator();