Identify hot paths with a flame graph (C#, Visual Basic, C++, F#)

The Flame Graph in the CPU Usage tool helps you identify hot paths in your code by visualizing a call tree. Flame graphs are a visualization of categorized data, created to visualize stack traces of profiled software so that the most frequent code paths can be identified quickly and accurately. The graph gives a visual overview of where time is being spent in your application and you can click on specific nodes to dig into them further.

Screenshot showing Flame Graph with tooltips displayed.

For a tutorial that shows how to improve performance using the flame graph, see Beginner's guide to optimizing code.

Investigate hot paths

  1. The Flame Graph view is in the details view of the CPU Usage tool, above the source line highlighting view. After you've stopped your profiling session, you can view the Flame Graph by clicking Open details.

    Screenshot showing Open details selected.

  2. Select Flame Graph in the Current View dropdown selection.

    Screenshot showing Flame Graph view selected.

    Screenshot showing Flame Graph overview displayed.

  3. By default, the flame graph in the CPU tool is shown upside down or as an "icicle chart," where the y-axis is counting stack depth downwards from zero at the top. You can view the standard flame chart layout by clicking Flip Flame Graph.

    Screenshot showing Flip Flame Graph selected.

For a complex flame graph, you can zoom the visualization by selecting specific elements.

In the Flame Graph view, you can navigate by clicking on a node with a mouse or using the keyboard. In addition, the following keyboard shortcuts are supported.

Keyboard shortcut Command
Tab Go to any node
Up/Down arrow Go to a node's parent or child
Right/left arrow Go to a node's peer on the stack
Enter Zoom in (select)
Escape Zoom out