Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers 18.0.36421.1

Prefix Reserved
dotnet add package Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers --version 18.0.36421.1
                    
NuGet\Install-Package Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers -Version 18.0.36421.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="18.0.36421.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" Version="18.0.36421.1" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers --version 18.0.36421.1
                    
#r "nuget: Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers, 18.0.36421.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers@18.0.36421.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers&version=18.0.36421.1
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers&version=18.0.36421.1
                    
Install as a Cake Tool

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: <FullPathToDiagsessionFile>

Where the "Exported diagsession file" will include the full path to the diagsession file that was generated

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on Microsoft.VisualStudio.DiagnosticsHub.BenchmarkDotNetDiagnosers:

Repository Stars
dotnet/BenchmarkDotNet
Powerful .NET library for benchmarking
tonybaloney/CSnakes
Embed Python in .NET
corvus-dotnet/Corvus.JsonSchema
Support for Json Schema validation and entity generation
Version Downloads Last Updated
18.0.36421.1 0 8/22/2025
18.0.36419.1 14 8/19/2025
18.0.36412.2 104 8/13/2025
18.0.36328.1 308 7/29/2025
18.0.36313.1 313 7/14/2025
18.0.36311.3 188 7/11/2025
18.0.36302.1 955 7/3/2025
18.0.36127.1 3,483 5/28/2025
17.14.36021.1 1,363 4/21/2025
17.13.35606.1 10,468 12/7/2024
17.13.35603.1 315 12/3/2024
17.13.35505.2 1,070 11/5/2024
17.12.35209.2 7,422 8/12/2024
17.12.35112.1 257 7/12/2024
17.12.35103.4 162 7/3/2024
17.11.34824.1 379 4/24/2024