From c5c0fceda429f069e584481519b203c9f6f0cf4a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 14 Jun 2024 18:25:50 +0200 Subject: [PATCH] Add instrumentation statistics achievement. --- profiler/src/profiler/TracyAchievementData.cpp | 12 +++++++++++- profiler/src/profiler/TracyView_Statistics.cpp | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/profiler/src/profiler/TracyAchievementData.cpp b/profiler/src/profiler/TracyAchievementData.cpp index 797a83cb..a324191d 100644 --- a/profiler/src/profiler/TracyAchievementData.cpp +++ b/profiler/src/profiler/TracyAchievementData.cpp @@ -22,6 +22,16 @@ AchievementItem* ac_samplingItems[] = { &ai_samplingIntro, nullptr }; AchievementCategory ac_sampling = { "sampling", "Sampling", ac_samplingItems }; +AchievementItem ai_instrumentationStatistics = { "instrumentationStatistics", "Show me the stats!", [](const ctx& c){ + ImGui::TextWrapped( "Once you have instrumented your application, you can view the statistics for each zone in the timeline. This allows you to see how much time is spent in each zone and how many times it is called." ); + ImGui::TextWrapped( "To view the statistics, click on the '" ICON_FA_ARROW_UP_WIDE_SHORT " Statistics' button on the top bar. This will open a new window with a list of all zones in the trace." ); +} }; + +AchievementItem* ac_instrumentationIntroItems[] = { + &ai_instrumentationStatistics, + nullptr +}; + AchievementItem ai_instrumentationIntro = { "instrumentationIntro", "Instrumentating your application", [](const ctx& c){ constexpr const char* src = R"(#include "Tracy.hpp" @@ -47,7 +57,7 @@ void SomeFunction() ImGui::TextWrapped( "The above description applies to C++ code, but things are done similarly in other programming languages. Refer to the documentation for your language for more information." ); ImGui::PopStyleColor(); ImGui::PopFont(); -} }; +}, ac_instrumentationIntroItems }; AchievementItem* ac_instrumentationItems[] = { &ai_instrumentationIntro, nullptr }; AchievementCategory ac_instrumentation = { "instrumentation", "Instrumentation", ac_instrumentationItems }; diff --git a/profiler/src/profiler/TracyView_Statistics.cpp b/profiler/src/profiler/TracyView_Statistics.cpp index dcc6a6b3..92f4fccd 100644 --- a/profiler/src/profiler/TracyView_Statistics.cpp +++ b/profiler/src/profiler/TracyView_Statistics.cpp @@ -51,6 +51,8 @@ void View::DrawStatistics() return; } + Achieve( "instrumentationStatistics" ); + ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 2, 2 ) ); ImGui::RadioButton( ICON_FA_SYRINGE " Instrumentation", &m_statMode, 0 ); if( m_worker.AreCallstackSamplesReady() )