Skip to content

Repo sync for protected branch #10451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ef8de37
React, Vue, Angular updates
Mikejo5000 Oct 2, 2024
29eaa02
updates
Mikejo5000 Oct 2, 2024
d013183
edits
Mikejo5000 Oct 2, 2024
44471f0
edits
Mikejo5000 Oct 2, 2024
d43c8af
edits
Mikejo5000 Oct 3, 2024
e038c2f
links added
Mikejo5000 Oct 3, 2024
4c4cbd9
edits
Mikejo5000 Oct 3, 2024
5b70345
edits
Mikejo5000 Oct 3, 2024
75a2306
edits
Mikejo5000 Oct 3, 2024
bdeaaad
tweaks
Mikejo5000 Oct 3, 2024
7d336fe
fix warnings
Mikejo5000 Oct 3, 2024
849a667
link fix
Mikejo5000 Oct 3, 2024
65d449d
link updates, formatting fix
Mikejo5000 Oct 3, 2024
a836a7a
pencil edits
Stacyrch140 Oct 8, 2024
9f9631f
remove name from link text
Mikejo5000 Oct 8, 2024
68681c9
sync
Mikejo5000 Oct 8, 2024
a4a9d5c
removed name
Mikejo5000 Oct 8, 2024
32a23f8
sync
Mikejo5000 Oct 9, 2024
c5a76e6
sync
Mikejo5000 Oct 16, 2024
291ed5b
incorporate feedback
Mikejo5000 Oct 16, 2024
67938fe
Update Flame Graph article
Mikejo5000 Oct 16, 2024
4223fcf
Update art
Mikejo5000 Oct 18, 2024
32d2659
Added art
Mikejo5000 Oct 18, 2024
438fb8b
edits
Mikejo5000 Oct 18, 2024
e9ec9fd
edits
Mikejo5000 Oct 18, 2024
3a6ca43
edits
Mikejo5000 Oct 18, 2024
e438e0e
Updated art
Mikejo5000 Oct 21, 2024
5026e20
updates
Mikejo5000 Oct 21, 2024
0376cd1
art update
Mikejo5000 Oct 22, 2024
6f79fbc
art update
Mikejo5000 Oct 22, 2024
5abf57b
Merge pull request #13238 from Mikejo5000/mikejo-br25
JamesJBarnett Oct 22, 2024
b1b6fd9
Merged main into live
mijacobs Oct 22, 2024
cd930f7
Merging changes synced from https://github.com/MicrosoftDocs/visualst…
Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/profiling/dotnet-counters-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ The .NET Counters tool allows you to visualize [dotnet counters](/dotnet/core/di
> [!NOTE]
> The .NET Counters tool requires Visual Studio 2019 version 16.7 or later and targets .NET Core 3.0+ and .NET 5+.

For additional information on learning to use the .NET Counters tool effectively, see [Case study: Isolate a performance issue](../profiling/isolate-performance-issue.md).

## Setup

1. Open the Performance Profiler (**Alt + F2** or **Debug -> Performance Profiler**) in Visual Studio.
Expand Down
40 changes: 32 additions & 8 deletions docs/profiling/flame-graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,53 @@ monikerRange: '>= vs-2022'

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

The **Flame Graph** in the CPU Usage and Instrumentation tools help 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.
Visual Studio profiling tools for CPU utilization and instrumentation include the **Flame Graph** view. The **Flame Graph** helps you identify *hot paths* in your code by showing a visualization of the call tree. The *hot path* is the call stack for the functions that are using the most CPU or the most time, and is often a good place to look for potential performance optimizations. 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.](./media/vs-2022/flame-graph-tooltips.png "Flame Graph with tooltips displayed")
:::image type="content" source="./media/vs-2022/flame-graph-tooltips.gif" alt-text="Screenshot showing Flame Graph with context menu displayed." lightbox="media/vs-2022/flame-graph-tooltips.gif":::

For a tutorial that shows how to improve performance using the flame graph, see [Case study: Beginner's guide to optimizing code](../profiling/optimize-code-using-profiling-tools.md). For information on the CPU profiler, see [Analyze performance by using CPU profiling](../profiling/cpu-usage.md).

## Investigate hot paths

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

![Screenshot showing Open details selected.](./media/vs-2022/flame-graph-open-details.png "Open details view selected")
1. [Start a profiling session](../profiling/cpu-usage.md#collect-cpu-utilization-data) with either the CPU Usage or Instrumentation tool.

1. After you've stopped your profiling session and the report loads, select **Open details**.

![Screenshot showing Open Details selected.](./media/vs-2022/flame-graph-open-details.png "Open details view selected")

1. Select **Flame Graph** in the Current View dropdown selection.

![Screenshot showing Flame Graph view selected.](./media/vs-2022/flame-graph-view.png "Flame Graph view selected")

The Flame Graph view appears.

![Screenshot showing Flame Graph overview displayed.](./media/vs-2022/flame-graph-overview.png "Flame Graph overview displayed")
:::image type="content" source="./media/vs-2022/flame-graph-overview.png" alt-text="Screenshot showing Flame Graph overview displayed." lightbox="media/vs-2022/flame-graph-overview.png":::

The hot path is the code path using the most CPU or the most time as you look downward through the call tree.

By default, the data shown in the Flame Graph represents the same data as shown in the **Call tree** view for the data collection period. Specifically, for CPU Usage, it shows the **Total CPU** values. This value is inclusive, so it includes CPU utilization (that is, CPU computation time) used by calls to the function, and any other functions called by the function. In the same way, for Instrumentation, the graph shows the values equivalent to the **Total** column in the call tree view.

However, if you select a node, the selected node becomes the new baseline and uses 100% of the flame graph width. This allows you to better visualize a complex call tree and view long names when they're truncated or hidden. Here is an example of a flame graph that shows a more complex call tree.

:::image type="content" source="./media/vs-2022/flame-graph-complex-call-tree.gif" alt-text="Screenshot showing Flame Graph for a complex call tree." lightbox="media/vs-2022/flame-graph-complex-call-tree.gif":::

To view details about any node, select the node.

Choose **Reset Zoom** to return to the default view.

You can also navigate to different views in the profiling report by selecting a node, and then choosing an option such as **View in call tree** from the context menu.

:::image type="content" source="./media/vs-2022/flame-graph-view-in-call-tree.png" alt-text="Screenshot showing Flame Graph option to view in call tree." lightbox="media/vs-2022/flame-graph-view-in-call-tree.png":::

## Flip the Flame Graph

By default, the flame graph in the tool is shown upside down or as an *icicle chart*, where the y-axis is counting stack depth downwards from zero at the top.

1. By default, the flame graph in the 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**.
You can view a standard flame chart layout by clicking **Flip Flame Graph**.

![Screenshot showing Flip Flame Graph selected.](./media/vs-2022/flame-graph-flip.png "Flip Flame Graph selected")
![Screenshot showing Flip Flame Graph selected.](./media/vs-2022/flame-graph-flip.png "Flip Flame Graph selected")

## Navigate in the flame graph

Expand All @@ -53,5 +77,5 @@ In the Flame Graph view, you can navigate by clicking on a node with a mouse or

## Related content

- [Diagnose high latency with CPU Insights](../profiling/cpu-insights.md)
- [Case study: Beginner's guide to optimizing code](../profiling/optimize-code-using-profiling-tools.md)
- [Analyze CPU usage without debugging](../profiling/cpu-usage.md)
3 changes: 2 additions & 1 deletion docs/profiling/instrumentation-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ To use this tool from the command-line, see the following article:

## Related content

- [First look at profiling tools](../profiling/profiling-feature-tour.md)
- [Case study: Isolate a performance issue](../profiling/isolate-performance-issue.md)
- [Improving Visual Studio performance with the new Instrumentation Tool](https://devblogs.microsoft.com/visualstudio/improving-visual-studio-performance-with-the-new-instrumentation-tool/).
- [First look at profiling tools](../profiling/profiling-feature-tour.md)
3 changes: 2 additions & 1 deletion docs/profiling/instrumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ monikerRange: '>= vs-2022'
With the release of Visual Studio 2022 version 17.5, you can use the new dynamic Instrumentation tool. This tool shows the exact number of times your functions are called and is faster than the previous version of the Instrumentation tool. This tool supports .NET Core instrumentation without needing PDBs.
Starting in Visual Studio 2022 version 17.6 Preview 2, the tool also supports C/C++.

The tool is similar to the CPU Usage tool except it's based on wall clock time instead of CPU utilization. This means blocked time such as time spent waiting for locks will show up in the instrumentation trace, unlike the CPU Usage tool. For additional information on learning to use the Instrumentation tool effectively, see [Instrumentation Overview](../profiling/instrumentation-overview.md) and [Improving Visual Studio performance with the new Instrumentation Tool](https://devblogs.microsoft.com/visualstudio/improving-visual-studio-performance-with-the-new-instrumentation-tool/).
The tool is similar to the CPU Usage tool except it's based on wall clock time instead of CPU utilization. This means blocked time such as time spent waiting for locks will show up in the instrumentation trace, unlike the CPU Usage tool. For additional information on learning to use the Instrumentation tool effectively, see [Instrumentation Overview](../profiling/instrumentation-overview.md) and [Case study: Isolate a performance issue](../profiling/isolate-performance-issue.md).

## Instrument your application

Expand Down Expand Up @@ -102,4 +102,5 @@ Here is more information on the column values:
## Related content

- [Instrumentation](../profiling/instrumentation.md)
- [Improving Visual Studio performance with the new Instrumentation Tool](https://devblogs.microsoft.com/visualstudio/improving-visual-studio-performance-with-the-new-instrumentation-tool/)
- [First look at profiling tools](../profiling/profiling-feature-tour.md)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.