From da8c2340b324fcf3158a996c1b36983e5d7be44a Mon Sep 17 00:00:00 2001 From: Martijn Courteaux Date: Tue, 7 May 2024 13:33:57 +0200 Subject: [PATCH 1/2] Support adjusting plot height. --- manual/tracy.tex | 2 +- profiler/src/profiler/TracyViewData.hpp | 2 ++ profiler/src/profiler/TracyView_Options.cpp | 6 ++++++ profiler/src/profiler/TracyView_Plots.cpp | 5 +---- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/manual/tracy.tex b/manual/tracy.tex index a788418b..6e0bf4d8 100644 --- a/manual/tracy.tex +++ b/manual/tracy.tex @@ -3360,7 +3360,7 @@ Enabling the \emph{Ignore custom} option will force usage of the selected zone c Function names in the remaining places across the UI will be normalized unless this option is set to \emph{Disabled}. \end{itemize} \item \emph{\faLock{} Draw locks} -- Controls the display of locks. If the \emph{Only contended} option is selected, the profiler won't display the non-blocking regions of locks (see section~\ref{zoneslocksplots}). The \emph{Locks} drop-down allows disabling the display of locks on a per-lock basis. As a convenience, the list of locks is split into the single-threaded and multi-threaded (contended and uncontended) categories. Clicking the \RMB{}~right mouse button on a lock label opens the lock information window (section~\ref{lockwindow}). -\item \emph{\faSignature{} Draw plots} -- Allows disabling display of plots. Individual plots can be disabled in the \emph{Plots} drop-down. +\item \emph{\faSignature{} Draw plots} -- Allows disabling display of plots. Individual plots can be disabled in the \emph{Plots} drop-down. The vertical size of the plots can be adjusted using the \emph{Plot heights} slider. \item \emph{\faRandom{} Visible threads} -- Here you can select which threads are visible on the timeline. You can change the display order of threads by dragging thread labels. Threads can be sorted alphabetically with the \emph{Sort} button. \item \emph{\faImages{} Visible frame sets} -- Frame set display can be enabled or disabled here. Note that disabled frame sets are still available for selection in the frame set selection drop-down (section~\ref{controlmenu}) but are marked with a dimmed font. \end{itemize} diff --git a/profiler/src/profiler/TracyViewData.hpp b/profiler/src/profiler/TracyViewData.hpp index 7add9d1d..d479079e 100644 --- a/profiler/src/profiler/TracyViewData.hpp +++ b/profiler/src/profiler/TracyViewData.hpp @@ -58,6 +58,8 @@ struct ViewData ShortenName shortenName = ShortenName::NoSpaceAndNormalize; uint32_t frameTarget = 60; + + uint32_t plotHeight = 100; }; struct Annotation diff --git a/profiler/src/profiler/TracyView_Options.cpp b/profiler/src/profiler/TracyView_Options.cpp index 0f56056c..1954b48e 100644 --- a/profiler/src/profiler/TracyView_Options.cpp +++ b/profiler/src/profiler/TracyView_Options.cpp @@ -541,6 +541,12 @@ void View::DrawOptions() val = m_vd.drawPlots; ImGui::Checkbox( ICON_FA_SIGNATURE " Draw plots", &val ); m_vd.drawPlots = val; + + ImGui::SameLine(); + int pH = m_vd.plotHeight; + ImGui::SliderInt("Plot heights", &pH, 30, 200); + m_vd.plotHeight = pH; + const auto expand = ImGui::TreeNode( "Plots" ); ImGui::SameLine(); ImGui::TextDisabled( "(%zu)", m_worker.GetPlots().size() ); diff --git a/profiler/src/profiler/TracyView_Plots.cpp b/profiler/src/profiler/TracyView_Plots.cpp index 09a48c28..e1d03837 100644 --- a/profiler/src/profiler/TracyView_Plots.cpp +++ b/profiler/src/profiler/TracyView_Plots.cpp @@ -11,9 +11,6 @@ namespace tracy { -constexpr int PlotHeightPx = 100; - - bool View::DrawPlot( const TimelineContext& ctx, PlotData& plot, const std::vector& plotDraw, int& offset ) { auto draw = ImGui::GetWindowDrawList(); @@ -24,7 +21,7 @@ bool View::DrawPlot( const TimelineContext& ctx, PlotData& plot, const std::vect const auto hover = ctx.hover; const auto ty = ctx.ty; - const auto PlotHeight = PlotHeightPx * GetScale(); + const auto PlotHeight = GetViewData().plotHeight * GetScale(); auto yPos = wpos.y + offset; if( yPos + PlotHeight >= ctx.yMin && yPos <= ctx.yMax ) From b879f5b519e4ea0c1f79a7e477016cabd83daa9a Mon Sep 17 00:00:00 2001 From: Martijn Courteaux Date: Wed, 8 May 2024 10:43:14 +0200 Subject: [PATCH 2/2] Save plot height view data. --- profiler/src/profiler/TracyUserData.cpp | 2 ++ profiler/src/profiler/TracyView_Plots.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/profiler/src/profiler/TracyUserData.cpp b/profiler/src/profiler/TracyUserData.cpp index df0fb9cb..87c6d5f0 100644 --- a/profiler/src/profiler/TracyUserData.cpp +++ b/profiler/src/profiler/TracyUserData.cpp @@ -145,6 +145,7 @@ void UserData::LoadState( ViewData& data ) if( ini_sget( ini, "options", "ghostZones", "%d", &v ) ) data.ghostZones = v; if( ini_sget( ini, "options", "frameTarget", "%d", &v ) ) data.frameTarget = v; if( ini_sget( ini, "options", "shortenName", "%d", &v ) ) data.shortenName = (ShortenName)v; + if( ini_sget( ini, "options", "plotHeight", "%d", &v ) ) data.plotHeight = v; ini_free( ini ); } } @@ -193,6 +194,7 @@ void UserData::SaveState( const ViewData& data ) fprintf( f, "ghostZones = %d\n", data.ghostZones ); fprintf( f, "frameTarget = %d\n", data.frameTarget ); fprintf( f, "shortenName = %d\n", (int)data.shortenName ); + fprintf( f, "plotHeight = %d\n", data.plotHeight ); fclose( f ); } } diff --git a/profiler/src/profiler/TracyView_Plots.cpp b/profiler/src/profiler/TracyView_Plots.cpp index e1d03837..9eb02a6c 100644 --- a/profiler/src/profiler/TracyView_Plots.cpp +++ b/profiler/src/profiler/TracyView_Plots.cpp @@ -21,7 +21,7 @@ bool View::DrawPlot( const TimelineContext& ctx, PlotData& plot, const std::vect const auto hover = ctx.hover; const auto ty = ctx.ty; - const auto PlotHeight = GetViewData().plotHeight * GetScale(); + const auto PlotHeight = m_vd.plotHeight * GetScale(); auto yPos = wpos.y + offset; if( yPos + PlotHeight >= ctx.yMin && yPos <= ctx.yMax )