Skip to content

Commit ced3e7e

Browse files
Merge pull request #11875 from Mikejo5000/mikejo-br20
Add .NET Counter information for profiling in Diagnostics Hub and update profiling articles
2 parents d0dfadd + b71af42 commit ced3e7e

12 files changed

+58
-11
lines changed

docs/profiling/choose-performance-tool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The following table lists the different tools Visual Studio offers and provides
2626

2727
|Performance Tool|Description|When to use the tool?|
2828
|----------------------|---------------------|-------------|-------------|
29-
|[CPU Usage](../profiling/beginners-guide-to-performance-profiling.md)|Shows where the CPU is spending time.|&#x2022; Begin an investigation for general performance issues.</br>&#x2022; Investigate high Server CPU usage.</br>&#x2022; Investigate DevOps scenarios, such as when orders are not getting through to the retail website.</br>&#x2022; Optimize CPU usage.</br>&#x2022; Investigate latency in API calls.|
29+
|[CPU Usage](../profiling/beginners-guide-to-performance-profiling.md)|Shows where the CPU is spending time.|&#x2022; Begin an investigation for general performance issues.</br>&#x2022; Investigate high server CPU usage.</br>&#x2022; Investigate DevOps scenarios, such as when orders are not getting through to the retail website.</br>&#x2022; Optimize CPU usage.</br>&#x2022; Investigate latency in API calls.|
3030
|[Flame graph](../profiling/flame-graph.md)|View within the CPU Usage tool that provides an alternate visualization of the call tree.|Investigate latency in API calls|
3131
|[Hot path](../profiling/cpu-insights.md)|View within the CPU Usage tool that shows where most of the CPU time was spent in your application.|Investigate latency in API calls|
3232
|[PerfTips](../profiling/perftips.md)|Shows a quick measurement of performance information while interacting with your code.|While debugging, you want to see the elapsed time between the previous step operation (or breakpoint) to the current step or breakpoint.|

docs/profiling/dotnet-counters-tool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ manager: AndSter
1616
The .NET Counters tool allows you to visualize [dotnet counters](/dotnet/core/diagnostics/dotnet-counters) over time right from within the Visual Studio profiler.
1717

1818
> [!NOTE]
19-
> The .NET Counters tool requires Visual Studio 2019 version 16.7 or later and targets .NET Core 3.0+.
19+
> The .NET Counters tool requires Visual Studio 2019 version 16.7 or later and targets .NET Core 3.0+ and .NET 5+.
2020
2121
## Setup
2222

docs/profiling/instrumentation-overview.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Instrumentation"
33
description: Learn about the tools you can use to instrument your applications.
4-
ms.date: "03/31/2023"
4+
ms.date: "11/09/2023"
55
ms.topic: "conceptual"
66
author: "mikejo5000"
77
ms.author: "mikejo"
@@ -35,9 +35,9 @@ When it comes to profiling, there's two mechanisms of collecting data. Collectio
3535

3636
::: moniker range=">=vs-2022"
3737

38-
**Instrumentation** - Starting in Visual Studio 2022 version 17.5, the Instrumentation tool provides dynamic instrumentation for .NET Core, .NET 5+, and .NET Framework. This tool provides the best performance for instrumentation scenarios. Access this tool using the Performance Profiler (Alt + F2). For more information, see [Instrument your application](../profiling/instrumentation.md). For DLLs, you need to use the command-line tool (VSInstr) instead.
38+
**Instrumentation** - Starting in Visual Studio 2022 version 17.5, the Instrumentation tool provides dynamic instrumentation for .NET Core, .NET 5+, and .NET Framework. This tool provides the best performance for instrumentation scenarios. Access this tool using the Performance Profiler (Alt + F2). For more information, see [Instrument your application](../profiling/instrumentation.md).
3939

40-
Starting in Visual Studio 2022 version 17.6 Preview 2, the Instrumentation tool also supports C/C++, but uses static instrumentation (VSInstr).
40+
Starting in Visual Studio 2022 version 17.6, the Instrumentation tool also supports C/C++, but uses static instrumentation (VSInstr).
4141

4242
To use this tool from the command-line, see [Profiling apps from the command-line](../profiling/profile-apps-from-command-line.md).
4343
::: moniker-end
@@ -49,7 +49,7 @@ To use this tool from the command-line, see [Profiling apps from the command-lin
4949

5050
## Static instrumentation tool
5151

52-
**VSInstr** - Starting in Visual Studio 2022 version 17.6 Preview 2, the [Instrumentation tool](../profiling/instrumentation.md) uses VSInstr for C/C++ support. VSInstr is also used for command-line scenarios and works for .NET Framework, .NET 5+, and C/C++ apps. For instrumenting DLLs, the command-line tool is the only option. For more information, see [Collect detailed timing data for a stand-alone application by using the profiler command line](../profiling/collecting-detailed-timing-data-for-a-stand-alone-application.md).
52+
**VSInstr** - Starting in Visual Studio 2022 version 17.6 Preview 2, the [Instrumentation tool](../profiling/instrumentation.md) uses VSInstr for C/C++ support. VSInstr is also used for command-line scenarios and works for .NET Framework and C/C++ apps. For more information, see [Collect detailed timing data for a stand-alone application by using the profiler command line](../profiling/collecting-detailed-timing-data-for-a-stand-alone-application.md).
5353

5454
## See Also
5555

Loading
Loading
Loading
Loading
Loading
Loading
Loading

docs/profiling/profiling-feature-tour.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "First look at profiling tools"
33
description: "Take a brief look at the different diagnostic tools available in Visual Studio."
4-
ms.date: 04/24/2023
4+
ms.date: 11/09/2023
55
ms.topic: conceptual
66
f1_keywords:
77
- vs.diagnosticshub.overview
@@ -38,12 +38,14 @@ The profiling tools that you can access during a debugging session are available
3838

3939
::: moniker range=">=vs-2022"
4040
![Diagnostic Tools window](../profiling/media/vs-2022/prof-tour-diagnostic-tools.png "Diagnostic Tools")
41+
42+
While you are debugging, you can use the **Diagnostic Tools** window to analyze CPU, memory usage, .NET counters, and you can view events that show performance-related information.
4143
::: moniker-end
4244
::: moniker range="<=vs-2019"
4345
![Diagnostic Tools window](../profiling/media/prof-tour-diagnostic-tools.png "Diagnostic Tools")
44-
::: moniker-end
4546

4647
While you are debugging, you can use the **Diagnostic Tools** window to analyze CPU and memory usage, and you can view events that show performance-related information.
48+
::: moniker-end
4749

4850
::: moniker range=">=vs-2022"
4951
![Diagnostic Tools Summary view](../profiling/media/vs-2022/prof-tour-cpu-and-memory-graph.png "Diagnostic Tools Summary")
@@ -55,9 +57,18 @@ While you are debugging, you can use the **Diagnostic Tools** window to analyze
5557
The **Diagnostic Tools** window is a common way to profile apps, but for Release builds you can also do a post-mortem analysis of your app instead. For more information on different approaches, see [Run profiling tools with or without the debugger](../profiling/running-profiling-tools-with-or-without-the-debugger.md). To see profiling tool support for different app types, see [Which tool should I use?](../profiling/choose-performance-tool.md).
5658

5759
Tools available in the Diagnostic Tools window or during a debugging session include:
60+
::: moniker range=">=vs-2022"
61+
5862
- [CPU usage](../profiling/beginners-guide-to-performance-profiling.md)
5963
- [Memory usage](../profiling/memory-usage.md)
64+
- [.NET Counters](../profiling/dotnet-counters-tool.md)
6065
- [PerfTips](../profiling/perftips.md)
66+
::: moniker-end
67+
::: moniker range="<=vs-2019"
68+
- [CPU usage](../profiling/beginners-guide-to-performance-profiling.md)
69+
- [Memory usage](../profiling/memory-usage.md)
70+
- [PerfTips](../profiling/perftips.md)
71+
::: moniker-end
6172

6273
> [!TIP]
6374
> Use relaunch to skip the launch page and automatically run with your previous settings by pressing **Alt+F2** or by clicking **Debug > Performance Profiler**.
@@ -254,6 +265,7 @@ Starting in Visual Studio 2019 version 16.7, you can use the [.NET Counters tool
254265
The tool shows live values for each counter in a list view.
255266

256267
:::image type="content" source="../profiling/media/dotnet-counters-tool-collecting.png" alt-text=".NET Counter tool collecting.":::
268+
257269
## Analyze resource consumption (XAML)
258270

259271
In XAML apps, such as Windows desktop WPF apps and UWP apps, you can analyze resource consumption using the Application Timeline tool. For example, you can analyze the time spent by your application preparing UI frames (layout and render), servicing network and disk requests, and in scenarios like application startup, page load, and Window resize. To use the tool, choose **Application Timeline** in the Performance Profiler, and then choose **Start**. In your app, go through the scenario with a suspected resource consumption issue, and then choose **Stop collection** to generate the report.

docs/profiling/running-profiling-tools-with-or-without-the-debugger.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Run profiling tools with or without the debugger"
33
description: "Learn about differences between the different modes available for profiling tools"
4-
ms.date: "03/22/2023"
4+
ms.date: "11/09/2023"
55
ms.topic: "conceptual"
66
author: "mikejo5000"
77
ms.author: "mikejo"
@@ -26,16 +26,24 @@ To decide which tools and results to use, consider the following options:
2626
- The debugger itself changes performance times, as it does necessary debugger operations like intercepting exception and module load events.
2727
- Release build performance numbers in the Performance Profiler are the most precise and accurate. Debugger-integrated tool results are most useful to compare with other debugging-related measurements, or to use debugger features.
2828
- Some tools, such as the .NET Object Allocation tool, are only available for non-debugger scenarios.
29+
2930
- Debug vs. release build
3031
- For problems caused by CPU-intensive calls, there might be considerable performance differences between release and debug builds. Check to see whether the issue exists in release builds.
3132
- If the problem occurs only during debug builds, you probably don't need to run the non-debugger tools. For release build problems, decide whether features provided by the debugger-integrated tools will help to pinpoint the problem.
3233
- Release builds provide optimizations like inlining function calls and constants, pruning unused code paths, and storing variables in ways that can't be used by the debugger. Performance numbers in the debug builds are less accurate, because debug builds lack these optimizations.
3334

3435
## <a name="BKMK_Quick_start__Collect_diagnostic_data"></a> Collect profiling data while debugging
3536

37+
::: moniker range=">=vs-2022"
38+
When you start debugging in Visual Studio by selecting **Debug** > **Start Debugging**, or pressing **F5**, the **Diagnostic Tools** window appears by default. To open it manually, select **Debug** > **Windows** > **Show Diagnostic Tools**. The **Diagnostic Tools** window shows information about events, process memory, CPU usage, and .NET Counters.
39+
40+
![Screenshot of the Diagnostic Tools window.](../profiling/media/vs-2022/diagnostic-tools-window.png "Diagnostic Tools Window")
41+
::: moniker-end
42+
::: moniker range="<=vs-2019"
3643
When you start debugging in Visual Studio by selecting **Debug** > **Start Debugging**, or pressing **F5**, the **Diagnostic Tools** window appears by default. To open it manually, select **Debug** > **Windows** > **Show Diagnostic Tools**. The **Diagnostic Tools** window shows information about events, process memory, and CPU usage.
3744

3845
![Screenshot of the Diagnostic Tools window](../profiling/media/diagnostictoolswindow.png "Diagnostic Tools Window")
46+
::: moniker-end
3947

4048
- Use the **Settings** icon in the toolbar to select whether to view **Memory Usage**, **UI Analysis**, and **CPU Usage**.
4149

@@ -59,11 +67,23 @@ During a debugging session, the Events tab of the Diagnostic Tools window lists
5967

6068
Use the **Filter** drop-down list to filter events in and out of view, by selecting or clearing specific categories of events.
6169

70+
::: moniker range=">=vs-2022"
71+
![Screenshot of Diagnostic Event filter.](../profiling/media/vs-2022/diagnostic-event-filter.png "Diagnostic Event Filter")
72+
::: moniker-end
73+
::: moniker range="<=vs-2019"
6274
![Screenshot of Diagnostic Event filter](../profiling/media/diagnosticeventfilter.png "Diagnostic Event Filter")
75+
::: moniker-end
76+
77+
::: moniker range=">=vs-2022"
78+
Use the search box to find a specific string in the event list. Here are the results of a search for the file name *model* that matched three events:
6379

80+
![Screenshot of Diagnostic Event search.](../profiling/media/vs-2022/diagnostics-event-search.png "Diagnostic Event Search")
81+
::: moniker-end
82+
::: moniker range="<=vs-2019"
6483
Use the search box to find a specific string in the event list. Here are the results of a search for the string *name* that matched four events:
6584

6685
![Screenshot of Diagnostic Event search](../profiling/media/diagnosticseventsearch.png "Diagnostic Event Search")
86+
::: moniker-end
6787

6888
For more information, see [Searching and filtering the Events tab of the Diagnostic Tools window](https://devblogs.microsoft.com/devops/searching-and-filtering-the-events-tab-of-the-diagnostic-tools-window/).
6989

@@ -77,21 +97,36 @@ To collect performance data without debugging, you can run the Performance Profi
7797

7898
1. On the diagnostic tools launch page, select one or more tools to run. Only the tools that are applicable to the project type, operating system, and programming language are shown. Select **Show all tools** to also see tools that are disabled for this diagnostic session.
7999

100+
::: moniker range=">=vs-2022"
101+
![Screenshot of diagnostic tools.](../profiling/media/vs-2022/performance-profiler-summary-page.png "DIAG_SelectTool")
102+
::: moniker-end
103+
::: moniker range="<=vs-2019"
80104
![Screenshot of diagnostic tools](../profiling/media/diaghubsummarypage.png "DIAG_SelectTool")
105+
::: moniker-end
81106

82107
1. To start the diagnostic session, select **Start**.
83108

84-
While the session is running, some tools show graphs of real-time data on the diagnostic tools page, and controls to pause and resume data collection.
109+
While the session is running, some tools show graphs of real-time data on the diagnostic tools page, and might show options to pause and resume data collection.
85110

86-
![Screenshot of data collection on the Performance Profiler](../profiling/media/diaghubcollectdata.png "Hub collect data")
111+
::: moniker range=">=vs-2022"
112+
![Screenshot of data collection on the Performance Profiler.](../profiling/media/vs-2022/performance-profiler-collect-data.png "Diag collect data")
113+
::: moniker-end
114+
::: moniker range="<=vs-2019"
115+
![Screenshot of data collection on the Performance Profiler](../profiling/media/diaghubcollectdata.png "Hub collect data")
116+
::: moniker-end
87117

88118
1. To end the diagnostic session, select **Stop Collection**.
89119

90120
The analyzed data appears on the **Report** page.
91121

92122
You can save the reports, and open them from the **Recently Opened Sessions** list on the Diagnostic Tools launch page.
93123

124+
::: moniker range=">=vs-2022"
125+
![Screenshot of Diagnostic Tools Recently Opened Sessions list.](../profiling/media/vs-2022/performance-profiler-open-existing-diagnostics-session.png "PDHUB_OpenExistingDiagSession")
126+
::: moniker-end
127+
::: moniker range="<=vs-2019"
94128
![Screenshot of Diagnostic Tools Recently Opened Sessions list](../profiling/media/diaghubopenexistingdiagsession.png "PDHUB_OpenExistingDiagSession")
129+
::: moniker-end
95130

96131
For more information, see:
97132

0 commit comments

Comments
 (0)