From e49b96ec03e46a38d6eb03cf2f7756e03fd28aca Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 14 Jul 2026 16:54:00 +0200 Subject: [PATCH] Section items lister. --- profiler/src/profiler/TracyUtility.cpp | 21 +++++++++++++++++++++ profiler/src/profiler/TracyUtility.hpp | 1 + 2 files changed, 22 insertions(+) diff --git a/profiler/src/profiler/TracyUtility.cpp b/profiler/src/profiler/TracyUtility.cpp index 095dd740..b015b835 100644 --- a/profiler/src/profiler/TracyUtility.cpp +++ b/profiler/src/profiler/TracyUtility.cpp @@ -247,4 +247,25 @@ void PrintLocalStack( const CallstackFrameData* frame, const Worker& worker, con } } +RangeSlim ListSections( const Vector& sections, const Worker& worker ) +{ + RangeSlim out = {}; + int id = 0; + for( auto& v : sections ) + { + ImGui::PushID( id++ ); + const auto end = v.end.IsNonNegative() ? v.end.Val() : worker.GetLastTime(); + if( ImGui::MenuItem( worker.GetString( v.text ) ) ) + { + out.min = v.start.Val(); + out.max = end; + out.active = true; + } + ImGui::PopID(); + ImGui::SameLine(); + ImGui::TextDisabled( "%s - %s (%s)", TimeToStringExact( v.start.Val() ), TimeToStringExact( end ), TimeToString( end - v.start.Val() ) ); + } + return out; +} + } diff --git a/profiler/src/profiler/TracyUtility.hpp b/profiler/src/profiler/TracyUtility.hpp index 166bb868..3f09a50b 100644 --- a/profiler/src/profiler/TracyUtility.hpp +++ b/profiler/src/profiler/TracyUtility.hpp @@ -59,6 +59,7 @@ const char* FormatPlotValue( double val, PlotValueFormatting format ); std::vector SplitLines( const char* data, size_t sz ); void PrintLocalStack( const CallstackFrameData* frame, const Worker& worker, const View& view ); +RangeSlim ListSections( const Vector& sections, const Worker& worker ); }