Flame graphs are the most common way to visualize profiling data, with the aim of identifying the most resource-consuming code paths quickly and accurately.
A flame graph consists of frames, represented by rectangles on the graph. Each frame is part of a call stack, and the graph may have multiple call stacks displayed. The width of a frame denotes how much CPU time that frame consumed, and the depth and order of a stack’s frames represents the call sequence of that stack (the function calls initiated from the uppermost frame).
Flame graphs show aggregated data over a period of time, therefore, viewers should disregard time as a variable when considering their data. For example, a flame graph depicting profiling data for the last hour will show all the stacks that ran side-by-side, regardless of when each stack was executed during that hour.
The first layer of any flame graph will always be the root, and it will represent the entry point to the application. Frames on the second layer will include the processes that are running on the profiled cluster. Any layer beyond that will be function invocations that were invoked in that process, in the sequence that they were initiated within that given stack.
- Hovering: Hovering over a frame will reveal the function's name, resource consumption, and the number of samples.
- Clicking: Clicking a frame will zoom in and show the call stack leading to that frame and all its ancestry.
- Own time vs. Total time: Own time represents the actual CPU time spent executing the function, whereas total time represents the time spent executing the function in addition to the time spent executing the ancestry (functions called by the function) of that unique stack.
- Colors: Different frame colors indicate different runtimes.
- Search: Searching allows you to find frames that match the pattern you searched. The search function is a powerful tool that allows you to find frames within the graph and also identify the different processes and function calls important to your team.