Skip to content

Commit fab0821

Browse files
Merge pull request #14006 from Mikejo5000/mikejo-br26
Add usage details for BenchmarkDotNet, add links
2 parents d5c87d1 + 46e0958 commit fab0821

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
lines changed

docs/profiling/choose-performance-tool.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ The following table lists the different tools Visual Studio offers and provides
3333
|[Memory Usage](../profiling/memory-usage.md)|Shows your app’s memory to find issues such as memory leaks.|&#x2022; Optimize memory usage</br>&#x2022; Investigate UI freeze</br>&#x2022; Investigate suspected memory leak (native code)|
3434
|[.NET Object Allocation](../profiling/dotnet-alloc-tool.md)|Shows where .NET Objects are allocated and information about garbage collection.|&#x2022; Optimize .NET memory usage</br>&#x2022; Analyze garbage collection|
3535
|[Instrumentation](../profiling/instrumentation-overview.md)|Shows exact call counts and call times.|&#x2022; You need a tool like CPU Usage, but you want exact call counts and time spent in functions based on wall clock time.</br>&#x2022; You want to see blocked time, such as time spent waiting for locks.</br>&#x2022; Note: This tool requires extra overhead.|
36+
|[.NET Counters](../profiling/dotnet-counters-tool.md)|Live report for .NET counters.|&#x2022; Begin an investigation for general performance issues.</br>&#x2022; You want a trace for .NET counter-based metrics such as exceptions per second, garbage collection, and CPU utilization.|
37+
|[BenchmarkDotNet](../profiling/profiling-with-benchmark-dotnet.md)|Report for benchmarks based on BenchmarkDotNet.|&#x2022; Get different visualizations of BenchmarkDotNet collected data, such as CPU usage or memory allocations, based on the diagnoser in use.|
3638
|[File I/O](../profiling/use-file-io.md)|Shows your File I/O operations and how long they take and how much data they process.|Investigate UI freeze|
3739
|[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.|
3840
|[Events viewer](../profiling/events-viewer.md)|Shows HTTP requests, log messages, and exceptions.|&#x2022; Investigate latency in API calls</br>&#x2022; Investigate slow application running on a remote web server|
3941
|[.NET Async](../profiling/analyze-async.md)|Shows async/await usage in .NET apps.|Investigate suspected performance issue with asynchronous code.|
40-
|[.NET Counters](../profiling/dotnet-counters-tool.md)|Live report for .NET counters.|&#x2022; Begin an investigation for general performance issues.</br>&#x2022; You want a trace for .NET counter-based metrics such as exceptions per second, garbage collection, and CPU utilization.|
4142
|[Database](../profiling/analyze-database.md)|Shows performance of your database queries.|Investigate performance for database queries that use either ADO.NET or Entity Framework Core.|
4243
|[GPU Usage](./gpu-usage.md)|Shows high-level hardware usage of your Direct3D app.|Check whether the performance of your app is CPU-bound or GPU-bound.|
4344
|[Application Timeline](../profiling/application-timeline.md)|Shows UI performance for XAML apps.|Investigate UI performance in XAML apps, such as time spent rendering frames.|
@@ -53,11 +54,12 @@ The following table lists the different tools Visual Studio offers and the diffe
5354
|[Memory Usage](../profiling/memory-usage.md)|yes|yes|yes|yes|
5455
|[.NET Object Allocation](../profiling/dotnet-alloc-tool.md)|yes|no|yes|yes|
5556
|[Instrumentation](../profiling/instrumentation-overview.md)|yes|yes|yes|yes|
57+
|[.NET Counters](../profiling/dotnet-counters-tool.md)|yes (.NET Core/5+ only)|no|no|yes (ASP.NET Core only)|
58+
|[BenchmarkDotNet](../profiling/profiling-with-benchmark-dotnet.md)|yes|no|no|partial|
5659
|[File I/O](../profiling/use-file-io.md)|yes|yes|yes|yes|
5760
|[PerfTips](../profiling/perftips.md)|yes|yes|yes|yes|
5861
|[Events viewer](../profiling/events-viewer.md)|yes|yes|yes|yes|
5962
|[.NET Async](../profiling/analyze-async.md)|yes|no|yes|yes|
60-
|[.NET Counters](../profiling/dotnet-counters-tool.md)|yes (.NET Core/5+ only)|no|no|yes (ASP.NET Core only)|
6163
|[Database](../profiling/analyze-database.md)|yes (.NET Core/5+ only)|no|no|yes (ASP.NET Core only)|
6264
|[GPU Usage](./gpu-usage.md)|yes|yes|yes|no|
6365
|[Application Timeline](../profiling/application-timeline.md)|yes (XAML)|no|yes|no|
@@ -74,6 +76,7 @@ The following tools are supported with Linux or WSL as the target platform as we
7476
- .NET Object Allocation Tracking
7577
- .NET Async
7678
- .NET Counters
79+
- BenchmarkDotNet
7780
- Events Viewer
7881
- Database
7982

docs/profiling/index.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ landingContent:
6767
url: instrumentation-overview.md
6868
- text: .NET Counters
6969
url: dotnet-counters-tool.md
70+
- text: Benchmark.NET
71+
url: profiling-with-benchmark-dotnet.md
7072
- text: File I/O
7173
url: use-file-io.md
7274
- text: Database
7375
url: analyze-database.md
74-
- text: Benchmark.NET
75-
url: profiling-with-benchmark-dotnet.md
7676
- text: Events Viewer
7777
url: events-viewer.md
7878
- text: .NET Async

docs/profiling/profiling-feature-tour.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@ The tool shows live values for each counter in a list view.
274274
:::image type="content" source="../profiling/media/dotnet-counters-tool-collecting.png" alt-text=".NET Counter tool collecting.":::
275275

276276
This tool is supported for For .NET Core and .NET 5+ apps.
277+
278+
## Visualize BenchmarkDotNet data
279+
280+
Starting in Visual Studio 2022 version 17.9, you can view data collected using BenchmarkDotNet in the Visual Studio profiling tools. By adding benchmark attributes to your code, you can use specific diagnosers to analyze memory allocations, CPU usage, counters, and other performance data.
281+
282+
For more information, see [Analyze BenchmarkDotNet data in Visual Studio](../profiling/profiling-with-benchmark-dotnet.md).
283+
284+
:::image type="content" source="../profiling/media/vs-2022/benchmark-dotnet-diagsession.png" alt-text="BenchmarkDotNet data in the profiler.":::
277285
::: zone-end
278286

279287
## Examine application events

docs/profiling/profiling-with-benchmark-dotnet.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,28 @@ Each diagnoser generates performance data related to that diagnoser. For example
107107
Exported diagsession file: *.diagsession
108108
```
109109

110-
## View Benchmark .NET data
110+
## View BenchmarkDotNet data
111111

112112
1. In Visual Studio, select **File > Open > File** and navigate to the location of the *.diagsession* file, and then select and open the file.
113113

114-
1. Select the **Benchmark** tab to view BenchmarkDotNet data.
114+
1. Select the **Benchmarks** tab to view data for the BenchmarkDotNet benchmarks.
115115

116116
![Screenshot of BenchmarkDotNet data in Visual Studio.](../profiling/media/vs-2022/benchmark-dotnet-diagsession.png)
117117

118-
For more information about the results, see [BenchmarkDotNet](https://benchmarkdotnet.org/articles/overview.html) documentation.
118+
For more information about the results in the **Benchmarks** tab, see [BenchmarkDotNet](https://benchmarkdotnet.org/articles/overview.html) documentation.
119+
120+
1. Right-click a row in the results and choose **Select time range** to sync the timeline graph with the benchmark.
121+
122+
1. Select one of the available tabs such as **CPU Usage** or **Allocations**.
123+
124+
Depending on the diagnoser you used to collect data, you can gain insights related to memory allocation, CPU usage, counters, and other performance data. To analyze memory allocations, use the built-in [MemoryDiagnoser](https://benchmarkdotnet.org/articles/overview.html#diagnostics) by adding the \[MemoryDiagnoser\] attribute. For more information, see [Diagnosers](https://benchmarkdotnet.org/articles/configs/diagnosers.html).
125+
126+
> [!NOTE]
127+
> The profiler supports only the \[MemoryDiagnoser\] and the diagnosers listed previously in this article.
128+
129+
For an example of using the profiler to analyze memory allocations, see the blog post [Benchmarking with Visual Studio Profiler](https://devblogs.microsoft.com/visualstudio/benchmarking-with-visual-studio-profiler/).
130+
131+
To analyze data related to other tabs such as **CPU Usage**, see the corresponding articles in the profiling documentation.
119132

120133
## Related content
121134

docs/profiling/toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@
102102
href: instrumentation.md
103103
- name: .NET Counters
104104
href: dotnet-counters-tool.md
105+
- name: BenchmarkDotNet
106+
href: profiling-with-benchmark-dotnet.md
105107
- name: File IO
106108
href: use-file-io.md
107109
- name: PerfTips
@@ -116,8 +118,6 @@
116118
href: application-timeline.md
117119
- name: Add user marks to timeline
118120
href: add-timeline-graph-user-marks.md
119-
- name: BenchmarkDotNet
120-
href: profiling-with-benchmark-dotnet.md
121121
- name: Analyze GPU usage
122122
href: gpu-usage.md
123123
- name: Measure performance from the command-line

0 commit comments

Comments
 (0)