diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index 0c8cacdf..4e667abf 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -217,6 +217,7 @@ 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) +Embed(PROFILER_FILES TextFrameStatistics src/achievements/FrameStatistics.md TEXT) Embed(PROFILER_FILES TextGhostZones src/achievements/GhostZones.md TEXT) Embed(PROFILER_FILES TextGlobalSettings src/achievements/GlobalSettings.md TEXT) Embed(PROFILER_FILES TextGpu src/achievements/Gpu.md TEXT) diff --git a/profiler/src/achievements/FrameStatistics.md b/profiler/src/achievements/FrameStatistics.md new file mode 100644 index 00000000..dbcb253b --- /dev/null +++ b/profiler/src/achievements/FrameStatistics.md @@ -0,0 +1,12 @@ +# Frame statistics + +The [frame time graph](#frametimegraph) shows frames in time order: pick a slow frame, see it took 90 ms, zoom in, find what caused it. It cannot tell you whether 90 ms happens to one frame in a thousand or to one in twenty, and that decides whether you have a problem at all. + +The [Frame statistics window](#framestatistics) draws a histogram instead: each bar is a span of frame times, and its height is how many frames landed inside. The mean hides what matters: a program that runs its usual frame in 16 ms but stalls 200 ms once per second still reports a healthy average, while the player swears the game is stuttering. The percentiles show how long the *slow* frames actually ran. P99, for example, is the time ninety-nine of a hundred frames finished under. + +> [!TIP] +> **Tip** +> +> Hover a frame on the frame time graph and the histogram pulses a line at the bar containing it, so you can tell at a glance whether that stall was typical. + +Try clicking the * Frame statistics* button in the * Tools* menu and see what your frame times really look like. diff --git a/profiler/src/profiler/TracyAchievementData.cpp b/profiler/src/profiler/TracyAchievementData.cpp index 1491954d..504ed651 100644 --- a/profiler/src/profiler/TracyAchievementData.cpp +++ b/profiler/src/profiler/TracyAchievementData.cpp @@ -14,6 +14,7 @@ #include "data/TextEntryStacks.hpp" #include "data/TextFindZone.hpp" #include "data/TextFrameImages.hpp" +#include "data/TextFrameStatistics.hpp" #include "data/TextGhostZones.hpp" #include "data/TextGlobalSettings.hpp" #include "data/TextGpu.hpp" @@ -208,7 +209,13 @@ AchievementItem ai_lightFlame = { .text = Unpack( TextLightFlame ) }; -AchievementItem* ac_inspectZoneItems[] = { &ai_findZone, &ai_readSource, &ai_lightFlame, nullptr }; +AchievementItem ai_frameStats = { + .id = "frameStats", + .name = "Frame statistics", + .text = Unpack( TextFrameStatistics ) +}; + +AchievementItem* ac_inspectZoneItems[] = { &ai_findZone, &ai_readSource, &ai_lightFlame, &ai_frameStats, nullptr }; AchievementItem ai_inspectZone = { .id = "inspectZone", @@ -277,10 +284,13 @@ AchievementItem ai_frameImages = { .text = Unpack( TextFrameImages ) }; +AchievementItem* ac_addFrameSetsUnlock[] = { &ai_frameStats, nullptr }; + AchievementItem ai_addFrameSets = { .id = "addFrameSets", .name = "Add frame sets", - .text = Unpack( TextAddFrameSets ) + .text = Unpack( TextAddFrameSets ), + .unlocks = ac_addFrameSetsUnlock }; AchievementItem* ac_instrumentFramesItems[] = { diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 3e0b788c..5e11d25f 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -1011,6 +1011,7 @@ bool View::DrawImpl() } if( ButtonDisablable( ICON_FA_IMAGES " Frame statistics", !m_worker.AreFramesUsed() ) ) { + if( s_config.achievements ) Achieve( "frameStats" ); m_showFrameStatistics = true; } ImGui::EndPopup();