1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Move child zones into an expandable tree.

This commit is contained in:
Bartosz Taudul 2018-03-28 01:34:12 +02:00
parent 4d38ebe1b1
commit f6d4728494

View File

@ -2465,17 +2465,21 @@ void View::DrawZoneInfoWindow()
std::sort( cti.get(), cti.get() + ev.child.size(), [&ctt] ( const auto& lhs, const auto& rhs ) { return ctt[lhs] > ctt[rhs]; } ); std::sort( cti.get(), cti.get() + ev.child.size(), [&ctt] ( const auto& lhs, const auto& rhs ) { return ctt[lhs] > ctt[rhs]; } );
if( !ev.child.empty() ) if( !ev.child.empty() )
{
ImGui::Separator();
bool expand = ImGui::TreeNodeEx( "Child zones", ImGuiTreeNodeFlags_DefaultOpen );
ImGui::SameLine();
ImGui::TextDisabled( "(%s)", RealToString( ev.child.size(), true ) );
if( expand )
{ {
const auto ty = ImGui::GetTextLineHeight(); const auto ty = ImGui::GetTextLineHeight();
ImGui::Columns( 2 ); ImGui::Columns( 2 );
ImGui::Separator(); ImGui::TextColored( ImVec4( 1.0f, 1.0f, 0.4f, 1.0f ), "Exclusive time" );
ImGui::Text( "Child zones: %s", RealToString( ev.child.size(), true ) );
ImGui::NextColumn(); ImGui::NextColumn();
char buf[128]; char buf[128];
sprintf( buf, "Exclusive time: %s (%.2f%%)", TimeToString( ztime - ctime ), double( ztime - ctime ) / ztime * 100 ); sprintf( buf, "%s (%.2f%%)", TimeToString( ztime - ctime ), double( ztime - ctime ) / ztime * 100 );
ImGui::ProgressBar( double( ztime - ctime ) / ztime, ImVec2( -1, ty ), buf ); ImGui::ProgressBar( double( ztime - ctime ) / ztime, ImVec2( -1, ty ), buf );
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Separator();
for( size_t i=0; i<ev.child.size(); i++ ) for( size_t i=0; i<ev.child.size(); i++ )
{ {
auto& cev = *ev.child[cti[i]]; auto& cev = *ev.child[cti[i]];
@ -2503,6 +2507,8 @@ void View::DrawZoneInfoWindow()
ImGui::NextColumn(); ImGui::NextColumn();
} }
ImGui::EndColumns(); ImGui::EndColumns();
ImGui::TreePop();
}
} }
ImGui::End(); ImGui::End();
@ -2572,17 +2578,21 @@ void View::DrawGpuInfoWindow()
std::sort( cti.get(), cti.get() + ev.child.size(), [&ctt] ( const auto& lhs, const auto& rhs ) { return ctt[lhs] > ctt[rhs]; } ); std::sort( cti.get(), cti.get() + ev.child.size(), [&ctt] ( const auto& lhs, const auto& rhs ) { return ctt[lhs] > ctt[rhs]; } );
if( !ev.child.empty() ) if( !ev.child.empty() )
{
ImGui::Separator();
bool expand = ImGui::TreeNodeEx( "Child zones", ImGuiTreeNodeFlags_DefaultOpen );
ImGui::SameLine();
ImGui::TextDisabled( "(%s)", RealToString( ev.child.size(), true ) );
if( expand )
{ {
const auto ty = ImGui::GetTextLineHeight(); const auto ty = ImGui::GetTextLineHeight();
ImGui::Columns( 2 ); ImGui::Columns( 2 );
ImGui::Separator(); ImGui::TextColored( ImVec4( 1.0f, 1.0f, 0.4f, 1.0f ), "Exclusive time" );
ImGui::Text( "Child zones: %s", RealToString( ev.child.size(), true ) );
ImGui::NextColumn(); ImGui::NextColumn();
char buf[128]; char buf[128];
sprintf( buf, "Exclusive time: %s (%.2f%%)", TimeToString( ztime - ctime ), double( ztime - ctime ) / ztime * 100 ); sprintf( buf, "%s (%.2f%%)", TimeToString( ztime - ctime ), double( ztime - ctime ) / ztime * 100 );
ImGui::ProgressBar( double( ztime - ctime ) / ztime, ImVec2( -1, ty ), buf ); ImGui::ProgressBar( double( ztime - ctime ) / ztime, ImVec2( -1, ty ), buf );
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Separator();
for( size_t i=0; i<ev.child.size(); i++ ) for( size_t i=0; i<ev.child.size(); i++ )
{ {
auto& cev = *ev.child[cti[i]]; auto& cev = *ev.child[cti[i]];
@ -2609,6 +2619,8 @@ void View::DrawGpuInfoWindow()
ImGui::NextColumn(); ImGui::NextColumn();
} }
ImGui::EndColumns(); ImGui::EndColumns();
ImGui::TreePop();
}
} }
ImGui::End(); ImGui::End();