Add a reset view button to the flame graph.

This commit is contained in:
rmarker
2026-05-28 21:50:19 +09:30
parent 4a9e3ea095
commit cc4b7dcea9
2 changed files with 11 additions and 1 deletions

View File

@@ -4463,7 +4463,7 @@ The default sorting order of the zones on a flame graph \emph{approximates} the
You can use an alternative sorting method by enabling the \emph{Sort by time} option. This will place the most time-consuming zones first (to the left) on the graph.
You can navigate the flame graph using the mouse. Use the mouse wheel to zoom in and out around the mouse pointer. Pressing the \keys{\ctrl} key makes zooming more precise, while pressing the \keys{\shift} key makes it faster. Dragging with the \RMB{}~right mouse button pans the graph horizontally and vertically. The bar below the time ruler shows the current horizontal view position and can be dragged to pan the graph.
You can navigate the flame graph using the mouse. Use the mouse wheel to zoom in and out around the mouse pointer. Pressing the \keys{\ctrl} key makes zooming more precise, while pressing the \keys{\shift} key makes it faster. Dragging with the \RMB{}~right mouse button pans the graph horizontally and vertically. The bar below the time ruler shows the current horizontal view position and can be dragged to pan the graph. The \emph{Reset view} button resets the view to show the whole graph.
Similar to the statistics window (section~\ref{statistics}), the flame graph can operate in two modes: \emph{\faSyringe{}~Instrumentation} and \emph{\faEyeDropper{}~Sampling}. In the instrumentation mode, the graph represents the zones you put in your program. In the sampling mode, the graph is constructed from the automatically captured call stack data (section~\ref{sampling}).

View File

@@ -998,6 +998,16 @@ void View::DrawFlameGraph()
ToggleButton( ICON_FA_RULER " Limits", m_showRanges );
}
ImGui::SameLine();
ImGui::SeparatorEx( ImGuiSeparatorFlags_Vertical );
ImGui::SameLine();
if( ImGui::SmallButton( "Reset view" ) )
{
m_flameGraphViewStart = 0;
m_flameGraphViewEnd = 0;
}
auto& td = m_worker.GetThreadData();
auto expand = ImGui::TreeNode( ICON_FA_SHUFFLE " Visible threads:" );
ImGui::SameLine();