From 000ae58203b7ea62b30ea835211c0e972f7be4b3 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 1 Nov 2026 18:30:08 +0100 Subject: [PATCH] Add a CPU data achievement. --- profiler/CMakeLists.txt | 1 + profiler/src/achievements/CpuData.md | 10 ++++++++++ profiler/src/profiler/TracyAchievementData.cpp | 9 ++++++++- profiler/src/profiler/TracyView.cpp | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 profiler/src/achievements/CpuData.md diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index 791f726d..0c8cacdf 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -213,6 +213,7 @@ Embed(PROFILER_FILES TextAppInfo src/achievements/AppInfo.md TEXT) Embed(PROFILER_FILES TextConnectToClient src/achievements/ConnectToClient.md TEXT) Embed(PROFILER_FILES TextContention src/achievements/Contention.md TEXT) Embed(PROFILER_FILES TextContextSwitches src/achievements/ContextSwitches.md TEXT) +Embed(PROFILER_FILES TextCpuData src/achievements/CpuData.md TEXT) Embed(PROFILER_FILES TextEntryStacks src/achievements/EntryStacks.md TEXT) Embed(PROFILER_FILES TextFindZone src/achievements/FindZone.md TEXT) Embed(PROFILER_FILES TextFrameImages src/achievements/FrameImages.md TEXT) diff --git a/profiler/src/achievements/CpuData.md b/profiler/src/achievements/CpuData.md new file mode 100644 index 00000000..6d328792 --- /dev/null +++ b/profiler/src/achievements/CpuData.md @@ -0,0 +1,10 @@ +# See every process that ran + +Context switch data also remembers every other process that ran during the session. The [CPU data window](#cpudata) lists them. You find it under the * Tools* menu as * CPU data*. Green entries are your program. Yellow marks threads the profiler knows. Sort by *Running time*: browsers, indexers, and daemons often use more CPU than the program you are profiling. The figure is real CPU time scaled to trace length, so above 100% means several cores were busy at once. *Slices* counts how often the scheduler put an entry on a core, *Core jumps* how often it put it on a different one. Hover your program in the list and the timeline draws its threads' paths across the cores. + +> [!TIP] +> **Tip** +> +> If the menu entry is disabled, the client captured no system data. The collection runs inside the profiled application, so the elevated rights the kernel demands must be granted to it. Details in [privilege elevation](#privilegeelevation). + +Try it on a busy capture and see who has been eating your CPU. diff --git a/profiler/src/profiler/TracyAchievementData.cpp b/profiler/src/profiler/TracyAchievementData.cpp index 61cee7da..1491954d 100644 --- a/profiler/src/profiler/TracyAchievementData.cpp +++ b/profiler/src/profiler/TracyAchievementData.cpp @@ -10,6 +10,7 @@ #include "data/TextConnectToClient.hpp" #include "data/TextContention.hpp" #include "data/TextContextSwitches.hpp" +#include "data/TextCpuData.hpp" #include "data/TextEntryStacks.hpp" #include "data/TextFindZone.hpp" #include "data/TextFrameImages.hpp" @@ -78,7 +79,13 @@ AchievementItem ai_contextSwitches = { .text = Unpack( TextContextSwitches ) }; -AchievementItem* ac_samplingIntroItems[] = { &ai_ghostZones, &ai_samplingStats, &ai_entryStacks, &ai_contextSwitches, nullptr }; +AchievementItem ai_cpuData = { + .id = "cpuData", + .name = "See every process that ran", + .text = Unpack( TextCpuData ) +}; + +AchievementItem* ac_samplingIntroItems[] = { &ai_ghostZones, &ai_samplingStats, &ai_entryStacks, &ai_contextSwitches, &ai_cpuData, nullptr }; AchievementItem ai_samplingIntro = { .id = "samplingIntro", diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index e0087892..3e0b788c 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -999,6 +999,7 @@ bool View::DrawImpl() const auto& ctd = m_worker.GetCpuThreadData(); if( ButtonDisablable( ICON_FA_SLIDERS " CPU data", ctd.empty() ) ) { + if( s_config.achievements ) Achieve( "cpuData" ); m_showCpuDataWindow = true; } ToggleButton( ICON_FA_NOTE_STICKY " Annotations", m_showAnnotationList );