diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index b8f99a32..86c6ffb5 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -277,6 +277,7 @@ private: void DrawWaitStacks(); void DrawFlameGraph(); void DrawFlameGraphHeader( uint64_t timespan ); + void DrawFlameGraphLevel( const std::vector& data, FlameGraphContext& ctx, uint64_t ts, int depth, bool samples ); void DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ctx, uint64_t ts, int depth, bool samples ); void BuildFlameGraph( const Worker& worker, std::vector& data, const Vector>& zones ); void BuildFlameGraph( const Worker& worker, std::vector& data, const Vector>& zones, const ContextSwitch* ctx ); diff --git a/profiler/src/profiler/TracyView_FlameGraph.cpp b/profiler/src/profiler/TracyView_FlameGraph.cpp index d820e836..3ad917e0 100644 --- a/profiler/src/profiler/TracyView_FlameGraph.cpp +++ b/profiler/src/profiler/TracyView_FlameGraph.cpp @@ -260,6 +260,15 @@ struct FlameGraphContext double nxps; }; +void View::DrawFlameGraphLevel( const std::vector& data, FlameGraphContext& ctx, uint64_t ts, int depth, bool samples ) +{ + for( auto& v : data ) + { + DrawFlameGraphItem( v, ctx, ts, depth, samples ); + ts += v.time; + } +} + void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ctx, uint64_t ts, int depth, bool samples ) { const auto x0 = ctx.dpos.x + ts * ctx.pxns; @@ -448,12 +457,7 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct } } - uint64_t cts = ts; - for( auto& v : item.children ) - { - DrawFlameGraphItem( v, ctx, cts, depth+1, samples ); - cts += v.time; - } + DrawFlameGraphLevel( item.children, ctx, ts, depth+1, samples ); } void View::DrawFlameGraphHeader( uint64_t timespan ) @@ -532,6 +536,8 @@ static void MergeFlameGraph( std::vector& dst, std::vector