diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 136b794c..e3c9906c 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -4574,56 +4574,212 @@ void View::DrawGpuInfoWindow() ImGui::TextDisabled( "(%s)", RealToString( children.size(), true ) ); if( expand ) { - auto ctt = std::make_unique( children.size() ); - auto cti = std::make_unique( children.size() ); - uint64_t ctime = 0; - for( size_t i=0; igpuStart; - ctime += ct; - ctt[i] = ct; - cti[i] = uint32_t( i ); - } - - pdqsort_branchless( cti.get(), cti.get() + children.size(), [&ctt] ( const auto& lhs, const auto& rhs ) { return ctt[lhs] > ctt[rhs]; } ); - + const auto rztime = 1.0 / ztime; const auto ty = ImGui::GetTextLineHeight(); - ImGui::Columns( 2 ); - ImGui::TextColored( ImVec4( 1.0f, 1.0f, 0.4f, 1.0f ), "Self time" ); - ImGui::NextColumn(); - char buf[128]; - sprintf( buf, "%s (%.2f%%)", TimeToString( ztime - ctime ), double( ztime - ctime ) / ztime * 100 ); - ImGui::ProgressBar( double( ztime - ctime ) / ztime, ImVec2( -1, ty ), buf ); - ImGui::NextColumn(); - for( size_t i=0; i v; + }; + uint64_t ctime = 0; + flat_hash_map> cmap; + cmap.reserve( 128 ); + for( size_t i=0; isecond.t += ct; + it->second.v.push_back( i ); } - ImGui::PopID(); + + auto msz = cmap.size(); + Vector cgvec; + cgvec.reserve_exact( msz ); + size_t idx = 0; + for( auto& it : cmap ) + { + cgvec[idx++] = &it.second; + } + + pdqsort_branchless( cgvec.begin(), cgvec.end(), []( const auto& lhs, const auto& rhs ) { return lhs->t > rhs->t; } ); + + ImGui::Columns( 2 ); + ImGui::TextColored( ImVec4( 1.0f, 1.0f, 0.4f, 1.0f ), "Self time" ); ImGui::NextColumn(); - const auto part = double( ctt[cti[i]] ) / ztime; char buf[128]; - sprintf( buf, "%s (%.2f%%)", TimeToString( ctt[cti[i]] ), part * 100 ); - ImGui::ProgressBar( part, ImVec2( -1, ty ), buf ); + sprintf( buf, "%s (%.2f%%)", TimeToString( ztime - ctime ), double( ztime - ctime ) / ztime * 100 ); + ImGui::ProgressBar( double( ztime - ctime ) * rztime, ImVec2( -1, ty ), buf ); ImGui::NextColumn(); + for( size_t i=0; i( cgr.v.size() ); + auto cti = std::make_unique( cgr.v.size() ); + for( size_t i=0; i ctt[rhs]; } ); + + for( size_t i=0; i( children.size() ); + auto cti = std::make_unique( children.size() ); + uint64_t ctime = 0; + for( size_t i=0; i ctt[rhs]; } ); + + const auto ty = ImGui::GetTextLineHeight(); + ImGui::Columns( 2 ); + ImGui::TextColored( ImVec4( 1.0f, 1.0f, 0.4f, 1.0f ), "Self time" ); + ImGui::NextColumn(); + char buf[128]; + sprintf( buf, "%s (%.2f%%)", TimeToString( ztime - ctime ), double( ztime - ctime ) / ztime * 100 ); + ImGui::ProgressBar( double( ztime - ctime ) / ztime, ImVec2( -1, ty ), buf ); + ImGui::NextColumn(); + for( size_t i=0; i