Flame graph
This document describes the features and configuration of flame graphs.
Introduction
A flame graph visualizes software performance analysis data. Developers can use flame graphs to identify performance bottlenecks and understand the call relationships and execution time of different methods or code blocks. A rectangle's width is proportional to its execution time, and its height represents its depth in the call stack. Nested rectangles represent nested calls.
The performance analysis tool provides a combined Table + flame graph view. The method list table on the left includes the Self and Total columns, which show the CPU time consumed by each method. For example, java.util.LinkedList.node(int) has a self time of 1.94 s. The flame graph on the right uses colored, stacked bars to show the call stack and each method's percentage of time consumed. The total time and the entry method's percentage are displayed at the top. For further analysis, click the view SQL button in the upper-right corner.
Flame graph interactions
Continuous profiling displays data as an interactive flame graph or table, both of which support the interactions described below.
In the toolbar at the top of the analysis page, use the display mode drop-down list to switch views.
Flame graph
The width of each rectangle in the flame graph is determined by its Self and Total values. A hash of the method name + location determines its color. To interact with the flame graph, click a rectangle.
When you click a rectangle, a pop-up appears displaying statistics for the method, including % of Time spent, Time, and Samples. It also provides filters for the method name and location.
-
Focus the flame graph
Click focus to expand the selected rectangle to 100% width. This helps you analyze its context within the call stack.
-
Collapse or expand the flame graph
Click collapse/expand to collapse or expand the bottom of the call stack. This feature is useful for deep stacks where you want to ignore the bottom frames and focus on the top.
-
Reset the flame graph view
After focusing or collapsing the view, click reset view to return to the initial flame graph.
Table
-
Sort the table
Click a column header to sort by that column.
In the upper-left corner of the table, the method name + location drop-down list and the search box allow you to filter and locate specific methods.
Header
Description
method name + location
The name and location of the method. This corresponds to the
namefield in the profiling data.Self
The resources used exclusively by this method, not including its child methods.
Total
All resources used by this method, including its child methods.
-
Search the table
Enter a query in the search box to automatically search for matching methods.
-
Expand the table
By default, the table displays 50 rows. If the stack contains more entries, click More to display additional rows.
Table and flame graph
-
Highlighting
Clicking a row in the table highlights its corresponding rectangle in the flame graph, which helps you locate the method. The method list table on the left contains three columns: method name + location, Self, and Total. When you select the row for the
com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(JsonReader)method, it highlights in yellow, and a tooltip shows "Self 0.10% / Total 48.55% (Time: 4.86 s)". On the right, the flame graph shows the call stack expanding step-by-step:total(100%, 10.01 s)→java.lang.Thread.run()(93.91%, 9.40 s)→java.util.concurrent.ThreadPoolExecutor$Worker.run()(50.25%, 5.03 s)→java.util.concurrent.FutureTask.runAndReset()(47.95%, 4.80 s). This reveals an Alibaba Cloud-related call chain involving methods likecom.alibaba.cloud.web.ContinuousProfilerTask.fixedRateHotSpot(), and indicates that Gson deserialization is the primary performance bottleneck.
Common operations
-
View detailed metric values
Click or hover over elements in the table or flame graph to view detailed metric information.
Metric
Description
Unit
% of Time spent
The method's percentage of the total execution time.
-
Time
The time spent executing the code block.
Recorded metrics: nanoseconds, lock_nanoseconds
s (seconds), m (minutes), h (hours), d (days), M (months), Y (years)
RAM
Memory allocated by the code block. This is displayed when the profile type is profile_mem.
Recorded metrics: bytes, inuse_space
bytes, KB, MB, GB, TB, PB
Samples
The number of samples collected for the method.
Recorded metrics: objects, goroutines, exceptions, count
No suffix, K (10^3), M (10^6), B (10^9), T (10^12), P (10^15)
-
Copy the method name + location
Click the
icon next to a method or location to copy its name and location.