From 9d2f874b02929ecd3082120703901471a56b23ff Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 27 Oct 2024 11:58:23 +0100 Subject: [PATCH] Calculate flame graph begin times. --- profiler/src/profiler/TracyView_FlameGraph.cpp | 10 ++++++++++ server/TracyEvent.hpp | 1 + 2 files changed, 11 insertions(+) diff --git a/profiler/src/profiler/TracyView_FlameGraph.cpp b/profiler/src/profiler/TracyView_FlameGraph.cpp index e3aff9bc..5d9d890d 100644 --- a/profiler/src/profiler/TracyView_FlameGraph.cpp +++ b/profiler/src/profiler/TracyView_FlameGraph.cpp @@ -536,6 +536,15 @@ static void MergeFlameGraph( std::vector& dst, std::vector& data, uint64_t t = 0 ) +{ + for( auto& v : data ) + { + v.begin = t; + if( !v.children.empty() ) FixupTime( v.children, t ); + t += v.time; + } +} void View::DrawFlameGraph() @@ -700,6 +709,7 @@ void View::DrawFlameGraph() } if( m_flameSort ) SortFlameGraph( m_flameGraphData ); + FixupTime( m_flameGraphData ); } int64_t zsz = 0; diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 0f9020f4..73301fa1 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -850,6 +850,7 @@ struct FlameGraphItem { int64_t srcloc; int64_t time; + int64_t begin; std::vector children; };