Skip to content

Latest commit

 

History

History

Datadog.Trace.BenchmarkDotNet

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Datadog.Trace.BenchmarkDotNet NuGet package

This package contains the BenchmarkDotNet exporter and instrumentation for Datadog CI Visibility.

Compatibility

  • BenchmarkDotNet 0.13.2 and above

Getting Started

  1. Add the Datadog.Trace.BenchmarkDotNet NuGet package to your project, using dotnet add package Datadog.Trace.BenchmarkDotNet, for example.
  2. Configure your project to use the Datadog.Trace.BenchmarkDotNet exporter, as described below
  3. Configure your CI provider to report via the Datadog Agent or agentless, as described in the documentation
  4. Run the benchmark project and check results on Datadog CI Test Visibility.

Configure the project

There's two way to configure a benchmark project to use the Datadog's exporter:

By Attribute

Add the DatadogDiagnoser attribute to the benchmark class.

using BenchmarkDotNet.Attributes;
using Datadog.Trace.BenchmarkDotNet;

[DatadogDiagnoser]
[MemoryDiagnoser]
public class OperationBenchmark
{
    [Benchmark]
    public void Operation()
    {
        // ...
    }
}

By Configuration

Use the WithDatadog() extension method on the current project configuration:

using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using Datadog.Trace.BenchmarkDotNet;

var config = DefaultConfig.Instance
    .WithDatadog();

BenchmarkRunner.Run<OperationBenchmark>(config);

Get in touch

If you have questions, feedback, or feature requests, reach our support.