Skip to content

Commit bf831d3

Browse files
authored
Screenshot Consistency - Visual Studio 2026 (#15303)
* images * images * images * images * images * images * images * images * images * images
1 parent f15cc13 commit bf831d3

11 files changed

Lines changed: 105 additions & 19 deletions

docs/profiling/beginners-guide-to-performance-profiling.md

Lines changed: 105 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Measure CPU utilization in your apps"
33
description: Measure and analyze CPU performance issues in your C#, Visual Basic, C++, or F# application by using the debugger-integrated diagnostics tools in Visual Studio.
4-
ms.date: 02/05/2025
4+
ms.date: 04/23/2026
55
ms.topic: tutorial
66
helpviewer_keywords:
77
- "Profiling Tools, quick start"
@@ -42,7 +42,11 @@ In this tutorial, you will:
4242

4343
4. You can choose whether to see **CPU Usage**, [Memory Usage](../profiling/Memory-Usage.md), or both, with the **Select Tools** setting on the toolbar. If you are running Visual Studio Enterprise, you can also enable or disable IntelliTrace in **Tools** > **Options** > **IntelliTrace**.
4444

45-
::: moniker range=">=vs-2022"
45+
::: moniker range="visualstudio"
46+
![Screenshot that shows the Select Tools menu.](../profiling/media/visualstudio/diagnostic-tools-select-tool.png "Select Tools menu")
47+
::: moniker-end
48+
49+
::: moniker range="vs-2022"
4650
![Screenshot that shows Diagnostics Tools.](../profiling/media/vs-2022/diag-tools-select-tool.png "DiagToolsSelectTool")
4751
::: moniker-end
4852

@@ -52,7 +56,12 @@ In this tutorial, you will:
5256
5. Click **Debug** > **Start Debugging** (or **Start** on the toolbar, or **F5**).
5357

5458
When the app finishes loading, the Summary view of the Diagnostics Tools appears. If you need to open the window, click **Debug** > **Windows** > **Show Diagnostic Tools**.
55-
::: moniker range=">=vs-2022"
59+
60+
::: moniker range="visualstudio"
61+
![Screenshot that shows Diagnostics Tools Summary tab.](../profiling/media/visualstudio/diagnostic-tools-summary-tab.png "Diagnostic Tools Summary tab")
62+
::: moniker-end
63+
64+
::: moniker range="vs-2022"
5665
![Screenshot that shows Diagnostics Tools Summary Tab.](../profiling/media/vs-2022/diag-tools-summary-tab.png "DiagToolsSummaryTab")
5766
::: moniker-end
5867

@@ -63,27 +72,40 @@ In this tutorial, you will:
6372

6473
7. While the debugger is paused, enable the collection of the CPU Usage data and then open the **CPU Usage** tab.
6574

66-
::: moniker range=">=vs-2022"
67-
![Screenshot that shows Diagnostics Tools enable CPU profiling.](../profiling/media/vs-2022/diag-tools-enable-cpu-profiling.png "DiagToolsEnableCPUProfiling")
68-
::: moniker-end
75+
::: moniker range="visualstudio"
76+
![Screenshot that shows the CPU Usage tab.](../profiling/media/visualstudio/diagnostic-tools-enable-cpu-profiling.png "CPU Usage tab")
6977

78+
When you select **Start Recording**, Visual Studio will begin recording your functions and how much time they take to execute. You can only view this collected data when your application is halted at a breakpoint.
79+
::: moniker-end
7080

81+
::: moniker range="vs-2022"
82+
![Screenshot that shows Diagnostics Tools enable CPU profiling.](../profiling/media/vs-2022/diag-tools-enable-cpu-profiling.png "DiagToolsEnableCPUProfiling")
83+
7184
When you choose **Record CPU Profile**, Visual Studio will begin recording your functions and how much time they take to execute. You can only view this collected data when your application is halted at a breakpoint.
85+
::: moniker-end
7286

7387
8. Hit F5 to run the app to your second breakpoint.
7488

7589
Now, you now have performance data for your application specifically for the region of code that runs between the two breakpoints.
7690

7791
The profiler begins preparing thread data. Wait for it to finish.
7892

79-
::: moniker range=">=vs-2022"
93+
::: moniker range="visualstudio"
94+
![Screenshot that shows Diagnostics Tools preparing data.](../profiling/media/visualstudio/diagnostic-tools-preparing-data.png "Diagnostic Tools preparing data")
95+
::: moniker-end
96+
97+
::: moniker range="vs-2022"
8098
![Screenshot that shows Diagnostics Tools preparing threads.](../profiling/media/vs-2022/diag-tools-preparing-data.png "DiagToolsPreparingThreads")
8199
::: moniker-end
82100

83101

84102
The CPU Usage tool displays the report in the **CPU Usage** tab.
85103

86-
::: moniker range=">=vs-2022"
104+
::: moniker range="visualstudio"
105+
![Screenshot that shows the Diagnostics Tools CPU Usage tab.](../profiling/media/visualstudio/diagnostic-tools-cpu-usage-tab.png "Diagnostic Tools CPU Usage tab")
106+
::: moniker-end
107+
108+
::: moniker range="vs-2022"
87109
![Screenshot that shows Diagnostics Tools CPU Usage Tab.](../profiling/media/vs-2022/diag-tools-cpu-usage-tab.png "DiagToolsCPUUsageTab")
88110
::: moniker-end
89111

@@ -104,29 +126,84 @@ In this tutorial, you will:
104126

105127
We recommend that you begin analyzing your data by examining the list of functions under CPU Usage, identifying the functions that are doing the most work, and then taking a closer look at each one.
106128

107-
1. In the function list, examine the functions that are doing the most work.
129+
:::moniker range="visualstudio"
130+
1. In the **Top Functions** list, examine the functions that are doing the most work.
131+
132+
![Screenshot that shows the Top Functions List.](../profiling/media/visualstudio/diagnostic-tools-cpu-usage-function-list.png "Top Functions list")
108133

109-
::: moniker range=">=vs-2022"
110-
![Screenshot that shows Diagnostics Tools CPU Usage Function List.](../profiling/media/diag-tools-cpu-usage-function-list.png "DiagToolsCPUUsageFunctionList")
111-
::: moniker-end
134+
2. In the **Top Functions** list, select one of your app functions that's doing a lot of work.
135+
136+
When you select a function, the **Functions** view opens in the left pane. Select **Caller/Callee** view from the drop-down menu.
137+
138+
> [!TIP]
139+
> Functions in the left pane are listed in order starting with those doing the most work (they're not in call order). This helps you quickly identify the longest running functions.
112140
141+
:::image type="content" source="../profiling/media/visualstudio/diagnostic-tools-caller-callee.png" alt-text="Screenshot that shows the Diagnostics Tools Caller/Callee view." lightbox="../profiling/media/visualstudio/diagnostic-tools-caller-callee.png":::
142+
143+
In this view, the selected function shows up in the heading and in the **Current Function** box (DoWork, in this example). The function that called the current function is shown on the left under **Calling Functions**, and any functions called by the current function are shown in **Called Functions** box on the right. (You can select either box to change the current function.)
144+
145+
This view shows you the total time (ms) and the percentage of the overall app running time that the function has taken to complete. **Function Body** also shows you the total amount of time (and the percentage of time) spent in the function body excluding time spent in calling and called functions.
146+
147+
> [!TIP]
148+
> High values in **Function Body** may indicate a performance bottleneck within the function itself.
149+
150+
3. To see a higher-level view showing the order in which the functions are called, select **Call Tree** from the drop-down list at the top of the pane.
151+
152+
Each numbered area in the figure relates to a step in the procedure.
153+
154+
![Screenshot that shows the Diagnostics Tools Call Tree.](../profiling/media/visualstudio/diagnostic-tools-call-tree.png "Diagnostic Tools Call Tree")
155+
156+
|Image|Description|
157+
|-|-|
158+
|![Step 1](../profiling/media/ProcGuid_1.png "ProcGuid_1")|The top-level node in CPU Usage call tree, representing the application.|
159+
|![Step 2](../profiling/media/ProcGuid_2.png "ProcGuid_2")|In most apps, when the [Show External Code](#view-external-code) option is disabled, the second-level node is an **[External Call]** node that contains the system and framework code that starts and stops the app, draws the UI, controls thread scheduling, and provides other low-level services to the app.|
160+
|![Step 3](../profiling/media/ProcGuid_3.png "ProcGuid_3")|The children of the second-level node are the user-code methods and asynchronous routines that are called or created by the second-level system and framework code.|
161+
|![Step 4](../profiling/media/ProcGuid_4.png "ProcGuid_4")|Child nodes of a method contain data only for the calls of the parent method. When **Show External Code** is disabled, app methods can also contain an **[External Call]** node.|
162+
163+
Here is more information on the column values:
164+
165+
- **Total CPU** indicates how much work was done by the function and any functions called by it. High total CPU values point to the functions that are most expensive overall.
166+
167+
- **Self CPU** indicates how much work was done by the code in the function body, excluding the work done by functions that were called by it. High **Self CPU** values may indicate a performance bottleneck within the function itself.
168+
169+
- **Modules** The name of the module containing the function, or the number of modules containing the functions in an [External Call] node.
170+
171+
To see the function calls that use the highest percentage of the CPU in the call tree view, click **Expand Hot Path**. The hot path can help focus your investigation on the area that would have the most impact.
172+
173+
174+
![Screenshot that shows the hot path in the call tree.](../profiling/media/visualstudio/diagnostic-tools-hot-path.png "Hot path in the call tree")
175+
176+
> [!NOTE]
177+
> If you see code in the call tree marked as "broken" code or "unwalkable stack", this indicates that Event Tracing for Windows (ETW) events were likely dropped. Try collecting the same trace a second time to resolve the issue.
178+
179+
4. To see a different view of the data, select **Flame Graph** from the drop-down list at the top of the pane.
180+
181+
The flame graph provides a different visualization of the call tree that may help you to analyze the data. For more information, see [Identify hot paths with a flame graph](../profiling/flame-graph.md).
182+
183+
5. To see views of the data aggregated by function or by module, select **Functions** or **Modules** from the drop-down list at the top of the pane.
184+
185+
These views help to identify functions or modules that might be performance bottlenecks due to a combination of high call counts and/or performance issues.
186+
187+
![Screenshot that shows Diagnostics Tools Functions view.](../profiling/media/visualstudio/diagnostic-tools-functions-view.png)
188+
::: moniker-end
189+
190+
:::moniker range="vs-2022"
191+
1. In the function list, examine the functions that are doing the most work.
192+
193+
![Screenshot that shows Diagnostics Tools CPU Usage Function List.](../profiling/media/diag-tools-cpu-usage-function-list.png "DiagToolsCPUUsageFunctionList")
113194

114195
> [!TIP]
115196
> Functions are listed in order starting with those doing the most work (they're not in call order). This helps you quickly identify the longest running functions.
116197
117198
2. In the function list, double-click one of your app functions that is doing a lot of work.
118199

119-
::: moniker range=">=vs-2022"
120-
121200
When you double-click a function, the **Functions** view opens in the left pane. Select **Caller/Callee** view from the drop-down menu.
122201

123202
![Screenshot that shows Diagnostics Tools Caller Callee View.](../profiling/media/vs-2022/diag-tools-caller-callee.png "DiagToolsCallerCallee")
124203

125204
In this view, the selected function shows up in the heading and in the **Current Function** box (DoWork, in this example). The function that called the current function is shown on the left under **Calling Functions**, and any functions called by the current function are shown in **Called Functions** box on the right. (You can select either box to change the current function.)
126205

127206
This view shows you the total time (ms) and the percentage of the overall app running time that the function has taken to complete. **Function Body** also shows you the total amount of time (and the percentage of time) spent in the function body excluding time spent in calling and called functions.
128-
::: moniker-end
129-
130207

131208
> [!TIP]
132209
> High values in **Function Body** may indicate a performance bottleneck within the function itself.
@@ -160,7 +237,6 @@ We recommend that you begin analyzing your data by examining the list of functio
160237
> [!NOTE]
161238
> If you see code in the call tree marked as "broken" code or "unwalkable stack", this indicates that Event Tracing for Windows (ETW) events were likely dropped. Try collecting the same trace a second time to resolve the issue.
162239
163-
::: moniker range=">=vs-2022"
164240
4. To see a different view of the data, select **Flame Graph** from the drop-down list at the top of the pane.
165241

166242
The flame graph provides a different visualization of the call tree that may help you to analyze the data. For more information, see [Identify hot paths with a flame graph](../profiling/flame-graph.md).
@@ -174,9 +250,19 @@ We recommend that you begin analyzing your data by examining the list of functio
174250

175251
## View external code
176252

177-
::: moniker range=">=vs-2022"
253+
::: moniker range="visualstudio"
254+
255+
External code is functions in system and framework components that are executed by the code you write. External code includes functions that start and stop the app, draw the UI, control threading, and provide other low-level services to the app. In most cases, you won't be interested in external code, and so the CPU Usage tool gathers the external functions of a user method into one **[External Call]** node.
256+
257+
If you want to view the call paths of external code, deselect **Show Just My Code** from the **Settings** list in the main **Diagnostic Tools** window and then select **Apply**.
258+
259+
![Screenshot that shows the Show Just My Code option.](../profiling/media/visualstudio/diagnostics-tools-show-external-code.png)
260+
261+
::: moniker-end
262+
263+
::: moniker range="vs-2022"
178264

179-
External code are functions in system and framework components that are executed by the code you write. External code includes functions that start and stop the app, draw the UI, control threading, and provide other low-level services to the app. In most cases, you won't be interested in external code, and so the CPU Usage tool gathers the external functions of a user method into one **[External Call]** node.
265+
External code is functions in system and framework components that are executed by the code you write. External code includes functions that start and stop the app, draw the UI, control threading, and provide other low-level services to the app. In most cases, you won't be interested in external code, and so the CPU Usage tool gathers the external functions of a user method into one **[External Call]** node.
180266

181267
If you want to view the call paths of external code, deselect **Show Just My Code** from the **Settings** list and then choose **Apply**.
182268

73.2 KB
Loading
69.4 KB
Loading
76.8 KB
Loading
157 KB
Loading
7.46 KB
Loading
83.4 KB
Loading
154 KB
Loading
12.5 KB
Loading
16.9 KB
Loading

0 commit comments

Comments
 (0)