Clip wait regions display.

This commit is contained in:
Bartosz Taudul 2020-02-10 00:12:34 +01:00
parent 4fc675814a
commit ffdd5290bf

View File

@ -6037,92 +6037,96 @@ void View::DrawZoneInfoWindow()
ImGui::Text( "State" ); ImGui::Text( "State" );
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Separator(); ImGui::Separator();
while( bit < eit ) const auto wrsz = eit - bit;
ImGuiListClipper clipper( wrsz );
while( clipper.Step() )
{ {
const auto cend = bit->End(); for( auto i=clipper.DisplayStart; i<clipper.DisplayEnd; i++ )
const auto state = bit->State(); {
const auto reason = bit->Reason(); const auto cend = bit[i].End();
const auto cpu0 = bit->Cpu(); const auto state = bit[i].State();
++bit; const auto reason = bit[i].Reason();
const auto cstart = bit->Start(); const auto cpu0 = bit[i].Cpu();
const auto cwakeup = bit->WakeupVal(); const auto cstart = bit[i+1].Start();
const auto cpu1 = bit->Cpu(); const auto cwakeup = bit[i+1].WakeupVal();
const auto cpu1 = bit[i+1].Cpu();
auto tt = adjust == 0 ? TimeToStringExact( cend ) : TimeToString( cend - adjust ); auto tt = adjust == 0 ? TimeToStringExact( cend ) : TimeToString( cend - adjust );
if( ImGui::Selectable( tt ) ) if( ImGui::Selectable( tt ) )
{
CenterAtTime( cend );
}
ImGui::NextColumn();
tt = adjust == 0 ? TimeToStringExact( cstart ) : TimeToString( cstart - adjust );
if( ImGui::Selectable( tt ) )
{
CenterAtTime( cstart );
}
ImGui::NextColumn();
if( ImGui::Selectable( TimeToString( cwakeup - cend ) ) )
{
ZoomToRange( cend, cwakeup );
}
ImGui::NextColumn();
if( cstart != cwakeup )
{
if( ImGui::Selectable( TimeToString( cstart - cwakeup ) ) )
{ {
ZoomToRange( cwakeup, cstart ); CenterAtTime( cend );
} }
} ImGui::NextColumn();
else tt = adjust == 0 ? TimeToStringExact( cstart ) : TimeToString( cstart - adjust );
{ if( ImGui::Selectable( tt ) )
ImGui::TextUnformatted( "-" ); {
} CenterAtTime( cstart );
ImGui::NextColumn(); }
if( cpu0 == cpu1 ) ImGui::NextColumn();
{ if( ImGui::Selectable( TimeToString( cwakeup - cend ) ) )
ImGui::TextUnformatted( RealToString( cpu0 ) ); {
} ZoomToRange( cend, cwakeup );
else }
{ ImGui::NextColumn();
if( cstart != cwakeup )
{
if( ImGui::Selectable( TimeToString( cstart - cwakeup ) ) )
{
ZoomToRange( cwakeup, cstart );
}
}
else
{
ImGui::TextUnformatted( "-" );
}
ImGui::NextColumn();
if( cpu0 == cpu1 )
{
ImGui::TextUnformatted( RealToString( cpu0 ) );
}
else
{
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
ImGui::Text( "%i " ICON_FA_LONG_ARROW_ALT_RIGHT " %i", cpu0, cpu1 ); ImGui::Text( "%i " ICON_FA_LONG_ARROW_ALT_RIGHT " %i", cpu0, cpu1 );
#else #else
ImGui::Text( "%i -> %i", cpu0, cpu1 ); ImGui::Text( "%i -> %i", cpu0, cpu1 );
#endif #endif
const auto tt0 = m_worker.GetThreadTopology( cpu0 ); const auto tt0 = m_worker.GetThreadTopology( cpu0 );
const auto tt1 = m_worker.GetThreadTopology( cpu1 ); const auto tt1 = m_worker.GetThreadTopology( cpu1 );
if( tt0 && tt1 ) if( tt0 && tt1 )
{
if( tt0->package != tt1->package )
{ {
ImGui::SameLine(); if( tt0->package != tt1->package )
TextDisabledUnformatted( "P" ); {
} ImGui::SameLine();
else if( tt0->core != tt1->core ) TextDisabledUnformatted( "P" );
{ }
ImGui::SameLine(); else if( tt0->core != tt1->core )
TextDisabledUnformatted( "C" ); {
ImGui::SameLine();
TextDisabledUnformatted( "C" );
}
} }
} }
ImGui::NextColumn();
const char* desc;
if( reason == ContextSwitchData::NoState )
{
ImGui::TextUnformatted( DecodeContextSwitchStateCode( state ) );
desc = DecodeContextSwitchState( state );
}
else
{
ImGui::TextUnformatted( DecodeContextSwitchReasonCode( reason ) );
desc = DecodeContextSwitchReason( reason );
}
if( *desc && ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( desc );
ImGui::EndTooltip();
}
ImGui::NextColumn();
} }
ImGui::NextColumn();
const char* desc;
if( reason == ContextSwitchData::NoState )
{
ImGui::TextUnformatted( DecodeContextSwitchStateCode( state ) );
desc = DecodeContextSwitchState( state );
}
else
{
ImGui::TextUnformatted( DecodeContextSwitchReasonCode( reason ) );
desc = DecodeContextSwitchReason( reason );
}
if( *desc && ImGui::IsItemHovered() )
{
ImGui::BeginTooltip();
ImGui::TextUnformatted( desc );
ImGui::EndTooltip();
}
ImGui::NextColumn();
} }
ImGui::EndColumns(); ImGui::EndColumns();