Skip to content

Commit 6f23839

Browse files
Merge pull request #13624 from Mikejo5000/mikejo-br25
Add content for multi-process analysis for CPU Usage
2 parents 041ffa7 + dc2e443 commit 6f23839

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

docs/profiling/cpu-usage.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: CPU profiling in the Performance Profiler
33
description: Learn about the CPU profiler performance tool, which shows the CPU time and percentage spent executing code in C++, C#, Visual Basic, and JavaScript apps.
4-
ms.date: 09/05/2024
4+
ms.date: 02/19/2025
55
ms.topic: how-to
66
ms.custom: "profiling-seo"
77
author: mikejo5000
@@ -199,7 +199,7 @@ To find a function name you're looking for, use the search box. Hover over the s
199199
![Screenshot that shows Search for nested external code.](../profiling/media/vs-2019/cpu-use-wt-show-external-code-too-wide-found.png "Search for nested external code")
200200
::: moniker-end
201201

202-
### <a name="BKMK_Asynchronous_functions_in_the_CPU_Usage_call_tree"></a> Asynchronous functions in the CPU usage call tree
202+
#### <a name="BKMK_Asynchronous_functions_in_the_CPU_Usage_call_tree"></a> Asynchronous functions in the CPU usage call tree
203203

204204
When the compiler encounters an asynchronous method, it creates a hidden class to control the method's execution. Conceptually, the class is a state machine. The class has compiler-generated functions that asynchronously call the original methods, and the callbacks, scheduler, and iterators needed to run them. When a parent method calls the original method, the compiler removes the method from the execution context of the parent, and runs the hidden class methods in the context of the system and framework code that controls app execution. The asynchronous methods are often, but not always, executed on one or more different threads. This code appears in the **CPU Usage** call tree as children of the **[External Code]** node immediately below the top node of the tree.
205205

@@ -224,6 +224,26 @@ Expand the generated methods to show what's going on:
224224
- `MainPage::<GetNumberAsync>b__b` shows the activity of the tasks that call `GetNumber`.
225225
::: moniker-end
226226

227+
::: moniker range=">=vs-2022"
228+
229+
### Analyze multi-process performance
230+
231+
Starting in Visual Studio 2022 version 17.13, you can analyze multi-process data in the CPU Usage tool. This makes it easier to analyzer performance for multi-process apps such as .NET Aspire. This features allows you to distinguish and analyze CPU utilization across processes within a single session, which provides clearer insights into resource consumption.
232+
233+
You need to collect multi-process data before you can analyze it. To collect the data, select **Collect data from multiple processes** for the CPU Usage tool in the Performance Profiler.
234+
235+
![Screenshot that shows selecting multi-process data.](../profiling/media/vs-2022/cpu-usage-collect-multi-process-data.png)
236+
237+
The timeline graph showing your app's CPU use displays performance data with distinct color coding for each process. The graphs are displayed as stacked area charts.
238+
239+
![Screenshot that shows multi-process data in the timeline.](../profiling/media/vs-2022/cpu-usage-view-multi-process-data.png)
240+
241+
You can filter processes using a dropdown on the top left of the CPU timeline graph. When you select or deselect a process, the profiler summary page and detailed reports are updated based on the new selection(s), enabling more precise analysis.
242+
243+
![Screenshot that shows multi-process filter.](../profiling/media/vs-2022/cpu-usage-multi-process-filter.png)
244+
::: moniker-end
245+
246+
227247
::: moniker range=">=vs-2022"
228248
### Collect call counts (.NET)
229249

26.8 KB
Loading
24.1 KB
Loading
25.1 KB
Loading

0 commit comments

Comments
 (0)