diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 9b5e91c0..e4d11722 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -6082,216 +6082,13 @@ void View::DrawZoneInfoWindow() ImGui::TextDisabled( "(%s)", RealToString( children.size(), true ) ); if( expand ) { - const auto rztime = 1.0 / ztime; - const auto ty = ImGui::GetTextLineHeight(); - - ImGui::SameLine(); - SmallCheckbox( "Group children locations", &m_groupChildrenLocations ); - - if( m_groupChildrenLocations ) + if( children.is_magic() ) { - struct ChildGroup - { - int16_t srcloc; - uint64_t t; - Vector 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 ); - } - - auto msz = cmap.size(); - Vector cgvec; - cgvec.reserve_and_use( 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 ); - TextColoredUnformatted( 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 ) * 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>( *(Vector*)( &children ), ztime ); } else { - auto ctt = std::make_unique( children.size() ); - auto cti = std::make_unique( children.size() ); - uint64_t ctime = 0; - for( size_t i=0; i ctt[rhs]; } ); - - ImGui::Columns( 2 ); - TextColoredUnformatted( 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 ) * rztime, ImVec2( -1, ty ), buf ); - ImGui::NextColumn(); - for( size_t i=0; i>( children, ztime ); } ImGui::TreePop(); } @@ -6409,6 +6206,223 @@ void View::DrawZoneInfoWindow() } } +template +void View::DrawZoneInfoChildren( const V& children, int64_t ztime ) +{ + Adapter a; + const auto rztime = 1.0 / ztime; + const auto ty = ImGui::GetTextLineHeight(); + + ImGui::SameLine(); + SmallCheckbox( "Group children locations", &m_groupChildrenLocations ); + + if( m_groupChildrenLocations ) + { + struct ChildGroup + { + int16_t srcloc; + uint64_t t; + Vector 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 ); + } + + auto msz = cmap.size(); + Vector cgvec; + cgvec.reserve_and_use( 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 ); + TextColoredUnformatted( 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 ) * 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]; } ); + + ImGui::Columns( 2 ); + TextColoredUnformatted( 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 ) * rztime, ImVec2( -1, ty ), buf ); + ImGui::NextColumn(); + for( size_t i=0; i + void DrawZoneInfoChildren( const V& children, int64_t ztime ); + void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns ); uint32_t GetThreadColor( uint64_t thread, int depth );