Add a flame graph achievement.

This commit is contained in:
Bartosz Taudul
2026-10-18 20:52:34 +02:00
parent 7b3ace0d2b
commit 5c0dc013d1
4 changed files with 17 additions and 1 deletions

View File

@@ -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)

View File

@@ -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!

View File

@@ -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",

View File

@@ -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();