From 5c0dc013d1d4e3f60356e837c6e2a8c7dbe08549 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 18 Oct 2026 20:52:34 +0200 Subject: [PATCH] Add a flame graph achievement. --- profiler/CMakeLists.txt | 1 + profiler/src/achievements/LightFlame.md | 7 +++++++ profiler/src/profiler/TracyAchievementData.cpp | 9 ++++++++- profiler/src/profiler/TracyView_FlameGraph.cpp | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 profiler/src/achievements/LightFlame.md diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index eecee756..09e5aee2 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -225,6 +225,7 @@ Embed(PROFILER_FILES TextLoadTrace src/achievements/LoadTrace.md TEXT) Embed(PROFILER_FILES TextLocks src/achievements/Locks.md TEXT) Embed(PROFILER_FILES TextManual src/achievements/Manual.md TEXT) Embed(PROFILER_FILES TextMemory src/achievements/Memory.md TEXT) +Embed(PROFILER_FILES TextLightFlame src/achievements/LightFlame.md TEXT) Embed(PROFILER_FILES TextPlots src/achievements/Plots.md TEXT) Embed(PROFILER_FILES TextReadSource src/achievements/ReadSource.md TEXT) Embed(PROFILER_FILES TextSamplingIntro src/achievements/SamplingIntro.md TEXT) diff --git a/profiler/src/achievements/LightFlame.md b/profiler/src/achievements/LightFlame.md new file mode 100644 index 00000000..d89b682b --- /dev/null +++ b/profiler/src/achievements/LightFlame.md @@ -0,0 +1,7 @@ +# Light the flame + +The timeline shows what happened when: every zone drawn at its exact duration, on its own thread. The [flame graph](#flamegraph) answers the other question, where the total time went. It merges all threads and sums every run of each zone per call stack, so a box's width is total time, not a single execution. + +Open it with the * Flame* button on the top bar. In *Instrumentation* mode the tree is built from your zones; hovering a box shows its execution and self time, clicking jumps to the zone statistics. In *Sampling* mode the tree is built from call stack samples, and clicking a box opens the source code. + +Open the flame graph and see where the time goes. Try it out! diff --git a/profiler/src/profiler/TracyAchievementData.cpp b/profiler/src/profiler/TracyAchievementData.cpp index 4fad92cd..c47e39a1 100644 --- a/profiler/src/profiler/TracyAchievementData.cpp +++ b/profiler/src/profiler/TracyAchievementData.cpp @@ -17,6 +17,7 @@ #include "data/TextInstrumentationStatistics.hpp" #include "data/TextIntro.hpp" #include "data/TextLeaks.hpp" +#include "data/TextLightFlame.hpp" #include "data/TextLoadTrace.hpp" #include "data/TextLocks.hpp" #include "data/TextManual.hpp" @@ -129,7 +130,13 @@ AchievementItem ai_readSource = { .text = Unpack( TextReadSource ) }; -AchievementItem* ac_inspectZoneItems[] = { &ai_findZone, &ai_readSource, nullptr }; +AchievementItem ai_lightFlame = { + .id = "lightFlame", + .name = "Light the flame", + .text = Unpack( TextLightFlame ) +}; + +AchievementItem* ac_inspectZoneItems[] = { &ai_findZone, &ai_readSource, &ai_lightFlame, nullptr }; AchievementItem ai_inspectZone = { .id = "inspectZone", diff --git a/profiler/src/profiler/TracyView_FlameGraph.cpp b/profiler/src/profiler/TracyView_FlameGraph.cpp index 4ffa4ece..5e49aed4 100644 --- a/profiler/src/profiler/TracyView_FlameGraph.cpp +++ b/profiler/src/profiler/TracyView_FlameGraph.cpp @@ -981,6 +981,7 @@ static void ClampFlameGraphViewport( int64_t& start, int64_t& end, int64_t total void View::DrawFlameGraph() { + if( s_config.achievements ) Achieve( "lightFlame" ); const auto scale = GetScale(); ImGui::SetNextWindowSize( ImVec2( 1400 * scale, 800 * scale ), ImGuiCond_FirstUseEver ); m_flameGraphConstraint.Constrain();