diff --git a/profiler/src/profiler/TracyView_FlameGraph.cpp b/profiler/src/profiler/TracyView_FlameGraph.cpp index 3c4b7736..0fab7dd0 100644 --- a/profiler/src/profiler/TracyView_FlameGraph.cpp +++ b/profiler/src/profiler/TracyView_FlameGraph.cpp @@ -828,11 +828,13 @@ static bool DrawFlameGraphHorizontalPosition( int64_t& vStart, int64_t& vEnd, do return false; } -static void MergeFlameGraph( std::vector& dst, std::vector&& src ) +static void MergeFlameGraph( std::vector& dst, std::vector&& src, bool byName ) { for( auto& v : src ) { - auto it = std::find_if( dst.begin(), dst.end(), [&v]( const auto& vv ) { return vv.srcloc == v.srcloc; } ); + auto it = byName ? + std::find_if( dst.begin(), dst.end(), [&v]( const auto& vv ) { return vv.name == v.name; } ) : + std::find_if( dst.begin(), dst.end(), [&v]( const auto& vv ) { return vv.srcloc == v.srcloc; } ); if( it == dst.end() ) { dst.emplace_back( std::move( v ) ); @@ -840,7 +842,7 @@ static void MergeFlameGraph( std::vector& dst, std::vectortime += v.time; - MergeFlameGraph( it->children, std::move( v.children ) ); + MergeFlameGraph( it->children, std::move( v.children ), byName ); } } } @@ -1171,10 +1173,11 @@ void View::DrawFlameGraph() m_flameGraphData.clear(); if( !threadData.empty() ) { + const auto byName = m_flameMode == 1 && m_flameSymbolByName; std::swap( m_flameGraphData, threadData[0] ); for( size_t i=1; i