Tomasz Sikora
Tomasz Sikora

Reputation: 1767

How to group benchmark results by method name in BenchmarkDotNet

I am trying to output my benchmarkDotNet results as grouped by Method name. Instead it is grouped by Range.

My benchmarks output looks like this:

Method Range Mean Error StdDev
FindPrimes 1000 23.377 us 0.1524 us 0.1425 us
FindPrimesSieveOfEratosthenes 1000 3.140 us 0.0196 us 0.0183 us
FindPrimes 10000 513.180 us 0.3876 us 0.3026 us
FindPrimesSieveOfEratosthenes 10000 31.487 us 0.1408 us 0.1175 us
FindPrimes 100000 12,266.783 us 90.4759 us 84.6312 us
FindPrimesSieveOfEratosthenes 100000 282.112 us 3.7559 us 3.5133 us

What I want:

Method Range Mean Error StdDev
FindPrimes 1000 23.377 us 0.1524 us 0.1425 us
FindPrimes 10000 513.180 us 0.3876 us 0.3026 us
FindPrimes 100000 12,266.783 us 90.4759 us 84.6312 us
FindPrimesSieveOfEratosthenes 1000 3.140 us 0.0196 us 0.0183 us
FindPrimesSieveOfEratosthenes 10000 31.487 us 0.1408 us 0.1175 us
FindPrimesSieveOfEratosthenes 100000 282.112 us 3.7559 us 3.5133 us

I was trying to set a custom configuration with orderer but I had no luck so far. Maybe I'm using wrong parameters:

var config = ManualConfig.CreateMinimumViable()
.WithOrderer(new DefaultOrderer(SummaryOrderPolicy.Declared, MethodOrderPolicy.Alphabetical))
.AddExporter(exporter); // an csv exporter, removed for brevity

BenchmarkRunner.Run<Benchmarks>(config);

Upvotes: 1

Views: 1116

Answers (1)

cicerosf
cicerosf

Reputation: 115

Have you tried adding this attribute above your class?

[Orderer(BenchmarkDotNet.Order.SummaryOrderPolicy.Method)]

Upvotes: 2

Related Questions