Fix expand-process separators in CPU data window.

This commit is contained in:
Bartosz Taudul 2023-01-05 22:48:07 +01:00
parent 006bfeaf56
commit 8a9deb69c8
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -530,10 +530,12 @@ void View::DrawCpuDataWindow()
auto& style = ImGui::GetStyle(); auto& style = ImGui::GetStyle();
const auto framePaddingY = style.FramePadding.y; const auto framePaddingY = style.FramePadding.y;
bool drawSeparator = false;
for( auto& pidit : psort ) for( auto& pidit : psort )
{ {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator ) ImGui::Separator();
char buf[128]; char buf[128];
auto& pid = *pidit; auto& pid = *pidit;
@ -562,6 +564,7 @@ void View::DrawCpuDataWindow()
ImGui::TextDisabled( "(%s)", RealToString( tsz ) ); ImGui::TextDisabled( "(%s)", RealToString( tsz ) );
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator ) ImGui::Separator();
ImGui::TextUnformatted( pid.first == 0 ? "???" : name ); ImGui::TextUnformatted( pid.first == 0 ? "???" : name );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
{ {
@ -573,20 +576,26 @@ void View::DrawCpuDataWindow()
m_drawThreadHighlight = pid.first; m_drawThreadHighlight = pid.first;
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator ) ImGui::Separator();
PrintStringPercent( buf, TimeToString( pid.second.data.runningTime ), double( pid.second.data.runningTime ) * rtimespan * 100 ); PrintStringPercent( buf, TimeToString( pid.second.data.runningTime ), double( pid.second.data.runningTime ) * rtimespan * 100 );
style.FramePadding.y = 0; style.FramePadding.y = 0;
ImGui::ProgressBar( double( pid.second.data.runningTime ) * rtimespan, ImVec2( -1, ty ), buf ); ImGui::ProgressBar( double( pid.second.data.runningTime ) * rtimespan, ImVec2( -1, ty ), buf );
style.FramePadding.y = framePaddingY; style.FramePadding.y = framePaddingY;
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator ) ImGui::Separator();
ImGui::TextUnformatted( RealToString( pid.second.data.runningRegions ) ); ImGui::TextUnformatted( RealToString( pid.second.data.runningRegions ) );
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator )
{
drawSeparator = false;
ImGui::Separator();
}
ImGui::TextUnformatted( RealToString( pid.second.data.migrations ) ); ImGui::TextUnformatted( RealToString( pid.second.data.migrations ) );
ImGui::SameLine(); ImGui::SameLine();
PrintStringPercent( buf, double( pid.second.data.migrations ) / pid.second.data.runningRegions * 100 ); PrintStringPercent( buf, double( pid.second.data.migrations ) / pid.second.data.runningRegions * 100 );
TextDisabledUnformatted( buf ); TextDisabledUnformatted( buf );
if( expand ) if( expand )
{ {
ImGui::Separator();
switch( sortspec.ColumnIndex ) switch( sortspec.ColumnIndex )
{ {
case 0: case 0:
@ -643,10 +652,12 @@ void View::DrawCpuDataWindow()
assert( false ); assert( false );
break; break;
} }
drawSeparator = true;
for( auto& tid : pid.second.tids ) for( auto& tid : pid.second.tids )
{ {
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator ) ImGui::Separator();
const auto tidMatch = pidMatch && m_worker.IsThreadLocal( tid ); const auto tidMatch = pidMatch && m_worker.IsThreadLocal( tid );
const char* tname; const char* tname;
@ -672,6 +683,7 @@ void View::DrawCpuDataWindow()
m_drawThreadHighlight = tid; m_drawThreadHighlight = tid;
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator ) ImGui::Separator();
if( tidMatch ) if( tidMatch )
{ {
SmallColorBox( GetThreadColor( tid, 0 ) ); SmallColorBox( GetThreadColor( tid, 0 ) );
@ -688,13 +700,20 @@ void View::DrawCpuDataWindow()
m_drawThreadHighlight = tid; m_drawThreadHighlight = tid;
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator ) ImGui::Separator();
PrintStringPercent( buf, TimeToString( tit->second.runningTime ), double( tit->second.runningTime ) * rtimespan * 100 ); PrintStringPercent( buf, TimeToString( tit->second.runningTime ), double( tit->second.runningTime ) * rtimespan * 100 );
style.FramePadding.y = 0; style.FramePadding.y = 0;
ImGui::ProgressBar( double( tit->second.runningTime ) * rtimespan, ImVec2( -1, ty ), buf ); ImGui::ProgressBar( double( tit->second.runningTime ) * rtimespan, ImVec2( -1, ty ), buf );
style.FramePadding.y = framePaddingY; style.FramePadding.y = framePaddingY;
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator ) ImGui::Separator();
ImGui::TextUnformatted( RealToString( tit->second.runningRegions ) ); ImGui::TextUnformatted( RealToString( tit->second.runningRegions ) );
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if( drawSeparator )
{
drawSeparator = false;
ImGui::Separator();
}
ImGui::TextUnformatted( RealToString( tit->second.migrations ) ); ImGui::TextUnformatted( RealToString( tit->second.migrations ) );
ImGui::SameLine(); ImGui::SameLine();
PrintStringPercent( buf, double( tit->second.migrations ) / tit->second.runningRegions * 100 ); PrintStringPercent( buf, double( tit->second.migrations ) / tit->second.runningRegions * 100 );
@ -705,7 +724,7 @@ void View::DrawCpuDataWindow()
} }
} }
ImGui::TreePop(); ImGui::TreePop();
ImGui::Separator(); drawSeparator = true;
} }
if( pidMatch ) if( pidMatch )
{ {