From 02a825b393412ca4e35aa3b6b9937e2b1ff97648 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 4 Nov 2026 01:26:03 +0100 Subject: [PATCH] Add a time range achievement. --- profiler/CMakeLists.txt | 1 + profiler/src/achievements/TimeRanges.md | 9 +++++++++ profiler/src/profiler/TracyAchievementData.cpp | 12 +++++++++++- profiler/src/profiler/TracyView.cpp | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 profiler/src/achievements/TimeRanges.md diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index d7ab71fb..8423bf52 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -248,6 +248,7 @@ Embed(PROFILER_FILES TextSamplingIntro src/achievements/SamplingIntro.md TEXT) Embed(PROFILER_FILES TextSamplingStats src/achievements/SamplingStats.md TEXT) Embed(PROFILER_FILES TextSaveTrace src/achievements/SaveTrace.md TEXT) Embed(PROFILER_FILES TextSurviveCrash src/achievements/SurviveCrash.md TEXT) +Embed(PROFILER_FILES TextTimeRanges src/achievements/TimeRanges.md TEXT) Embed(PROFILER_FILES TextWaitStacks src/achievements/WaitStacks.md TEXT) Embed(PROFILER_FILES TextZoneCallstacks src/achievements/ZoneCallstacks.md TEXT) Embed(PROFILER_FILES TextSections src/achievements/Sections.md TEXT) diff --git a/profiler/src/achievements/TimeRanges.md b/profiler/src/achievements/TimeRanges.md new file mode 100644 index 00000000..3cea8c4e --- /dev/null +++ b/profiler/src/achievements/TimeRanges.md @@ -0,0 +1,9 @@ +# Set a time range + +Statistics cover the whole capture by default. A [time range](#timeranges) limits a window to one part of the run. + +To mark a range, hold Ctrl and drag over the timeline. The menu that opens applies the range to one of six windows: Find zone, Statistics, Flame graph, Wait stacks, Memory, Frame statistics. Right-clicking a zone, section or frame opens the same menu with that item's extent. + +You can adjust a range by dragging its edges. The [Time range limits](#timerangelimits) window, under the * Tools* menu, lists all ranges. + +Try it out: Ctrl-drag a part of your capture, pick Statistics from the menu, and compare the numbers with the full capture. diff --git a/profiler/src/profiler/TracyAchievementData.cpp b/profiler/src/profiler/TracyAchievementData.cpp index 3213caa9..bce3736d 100644 --- a/profiler/src/profiler/TracyAchievementData.cpp +++ b/profiler/src/profiler/TracyAchievementData.cpp @@ -46,6 +46,7 @@ #include "data/TextSections.hpp" #include "data/TextSaveTrace.hpp" #include "data/TextSurviveCrash.hpp" +#include "data/TextTimeRanges.hpp" #include "data/TextWaitStacks.hpp" #include "data/TextZoneCallstacks.hpp" @@ -228,10 +229,19 @@ AchievementItem ai_readSource = { .items = ac_readSourceItems }; +AchievementItem ai_timeRanges = { + .id = "timeRanges", + .name = "Set a time range", + .text = Unpack( TextTimeRanges ) +}; + +AchievementItem* ac_annotationsItems[] = { &ai_timeRanges, nullptr }; + AchievementItem ai_annotations = { .id = "annotations", .name = "Annotate the timeline", - .text = Unpack( TextAnnotations ) + .text = Unpack( TextAnnotations ), + .items = ac_annotationsItems }; AchievementItem* ac_lightFlameItems[] = { &ai_annotations, nullptr }; diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 0a6fcc68..d9aba548 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -1261,6 +1261,7 @@ bool View::DrawImpl() { if( ImGui::Selectable( r.name ) ) { + if( s_config.achievements ) Achieve( "timeRanges" ); r.range->active = true; r.range->min = s; r.range->max = e;