Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers 18.3.36812.1
DiagnosticsHub BenchmarkDotNet Diagnosers
This nuget package allows you to add Diagnosers to your BenchmarkDotNet benchmark functions that allow you to profile your benchmarks using the performance profiling tools in Visual Studio.
You can find more information on BenchmarkDotNet here: https://benchmarkdotnet.org/
And you can find information on BenchmarkDotNet Diagnosers here: https://benchmarkdotnet.org/articles/configs/diagnosers.html?q=diagnoser
In order for the diagnosers in this nuget package to work, you must have Visual Studio 17.9 Preview 1 or newer installed on the machine running the benchmarks. You can also use an equivalent version of the Visual Studio Remote tools - more information on the remote tools can be found here: https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging
We currently provide the following diagnosers in this nuget package:
- CPUUsageDiagnoser
- DatabaseDiagnoser
- DotNetCountersDiagnoser
- EventsDiagnoser
- FileIODiagnoser
Each diagnoser will generate a .diagsession file that can be opened in Visual Studio that will contain performance data related to that diagnoser (the CPUUsageDiagnoser for example provides a diagsession file with CPU data in it, the DatabaseDiagnoser provides a diagsession file with data on database operations, etc.)
To add a diagnoser to your benchmark, you can add the diagnoser name as an attribute to the class that contains the benchmarks you want to generate diagsessions for. For example, the following class:
[CPUUsageDiagnoser]
public class Md5VsSha256
{
private const int N = 10000;
private readonly byte[] data;
private readonly SHA256 sha256 = SHA256.Create();
private readonly MD5 md5 = MD5.Create();
public Md5VsSha256()
{
data = new byte[N];
new Random(42).NextBytes(data);
}
[Benchmark]
public byte[] Sha256() => sha256.ComputeHash(data);
[Benchmark]
public byte[] Md5() => md5.ComputeHash(data);
}
Will create a diagsession file when run that contains CPU usage data on two benchmark function runs (Sha256 and Md5).
When the BenchmarkDotNet run completes there will be a few lines in the output that states where the diagsession was output to. Using the above for example will provide something like this for the output:
// * Diagnostic Output - VSDiagnosticsDiagnoser *
Collection result moved to 'BenchmarkDotNet_Md5VsSha256_20231218_123326.diagsession'.
Session : {7f38bcc2-c692-4266-aa24-b12bc5325ea4}
Stopped
Exported diagsession file:
Where the "Exported diagsession file" will include the full path to the diagsession file that was generated
No packages depend on Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers.
.NET Standard 2.0
- BenchmarkDotNet (>= 0.15.0)
| Version | Downloads | Last updated |
|---|---|---|
| 18.3.36812.1 | 2 | 02/24/2026 |
| 18.3.36726.2 | 1 | 02/27/2026 |
| 18.3.36714.1 | 1 | 02/27/2026 |
| 18.0.36525.3 | 1 | 02/27/2026 |
| 18.0.36421.1 | 1 | 02/27/2026 |
| 18.0.36419.1 | 1 | 02/27/2026 |
| 18.0.36412.2 | 1 | 02/27/2026 |
| 18.0.36328.1 | 1 | 02/27/2026 |
| 18.0.36313.1 | 1 | 02/27/2026 |
| 18.0.36311.3 | 1 | 02/27/2026 |
| 18.0.36302.1 | 1 | 02/27/2026 |
| 18.0.36127.1 | 1 | 02/27/2026 |
| 17.14.36021.1 | 1 | 02/27/2026 |
| 17.13.35606.1 | 1 | 02/27/2026 |
| 17.13.35603.1 | 1 | 02/27/2026 |
| 17.13.35505.2 | 1 | 02/27/2026 |
| 17.12.35209.2 | 1 | 02/27/2026 |
| 17.12.35112.1 | 1 | 02/27/2026 |
| 17.12.35103.4 | 1 | 02/27/2026 |
| 17.11.34824.1 | 1 | 02/27/2026 |