From eba8c1e99aba2a024804b5d9abdff4e1a92f7821 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 23 Jun 2026 21:49:15 +0200 Subject: [PATCH] Setup ranges array. --- profiler/src/profiler/TracyView.cpp | 13 +++++++++++++ profiler/src/profiler/TracyView.hpp | 6 ++++++ profiler/src/profiler/TracyViewData.hpp | 17 +++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index a2d66d12..f61e7d42 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -64,6 +64,7 @@ View::View( void(*cbMainThread)(const std::function&, bool), const char* { InitTextEditor(); SetupConfig(); + SetupRanges(); } View::View( void(*cbMainThread)(const std::function&, bool), FileRead& f, SetTitleCallback stcb, SetScaleCallback sscb, AttentionCallback acb, AchievementsMgr* amgr ) @@ -98,6 +99,7 @@ View::View( void(*cbMainThread)(const std::function&, bool), FileRead& f InitTextEditor(); SetupConfig(); + SetupRanges(); m_vd.zvStart = m_worker.GetFirstTime(); m_vd.zvEnd = m_worker.GetLastTime(); @@ -146,6 +148,17 @@ void View::SetupConfig() m_vd.plotHeight = s_config.plotHeight; } +void View::SetupRanges() +{ + m_ranges = {{ + { &m_findZone.range, 0x4488DD88, ICON_FA_MAGNIFYING_GLASS " Find zone" }, + { &m_statRange, 0x448888EE, ICON_FA_ARROW_UP_WIDE_SHORT " Statistics" }, + { &m_flameRange, 0x4488B5EE, ICON_FA_FIRE_FLAME_CURVED " Flame graph" }, + { &m_waitStackRange, 0x44EEB588, ICON_FA_HOURGLASS_HALF " Wait stacks" }, + { &m_memInfo.range, 0x4488EEE3, ICON_FA_MEMORY " Memory" }, + }}; +} + void View::Achieve( const char* id ) { if( !m_achievements || !m_achievementsMgr ) return; diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index f152f3c0..b7634606 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -193,6 +193,9 @@ public: nlohmann::json GetCallstackJson( const CallstackFrameId* data, size_t size ) const; + Range& GetRange( RangeId id ) { return *m_ranges[size_t(id)].range; } + const Range& GetRange( RangeId id ) const { return *m_ranges[size_t(id)].range; } + bool m_showRanges = false; Range m_statRange; Range m_flameRange; @@ -279,6 +282,7 @@ private: void InitTextEditor(); void SetupConfig(); + void SetupRanges(); void Achieve( const char* id ); void SaveUserData(); @@ -1025,6 +1029,8 @@ private: } } m_flameGraphInvariant; + std::array m_ranges; + #ifndef __EMSCRIPTEN__ TracyLlm m_llm; diff --git a/profiler/src/profiler/TracyViewData.hpp b/profiler/src/profiler/TracyViewData.hpp index 0d57ec45..49cd8af5 100644 --- a/profiler/src/profiler/TracyViewData.hpp +++ b/profiler/src/profiler/TracyViewData.hpp @@ -32,6 +32,23 @@ struct RangeSlim bool active = false; }; +struct RangeEntry +{ + Range* range; + uint32_t color; + const char* name; +}; + +enum class RangeId +{ + FindZone, + Statistics, + FlameGraph, + WaitStacks, + Memory, + NUM +}; + struct ViewData {