-
Notifications
You must be signed in to change notification settings - Fork 272
/
RecommendedConfig.cs
33 lines (32 loc) · 1.74 KB
/
RecommendedConfig.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Collections.Immutable;
using System.IO;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Exporters.Json;
using BenchmarkDotNet.Horology;
using BenchmarkDotNet.Jobs;
namespace BenchmarkDotNet.Extensions
{
public static class RecommendedConfig
{
public static IConfig Create(DirectoryInfo artifactsPath, ImmutableHashSet<string> mandatoryCategories, int? partitionCount = null, int? partitionIndex = null)
=> DefaultConfig.Instance
.With(Job.Default
.WithWarmupCount(1) // 1 warmup is enough for our purpose
.WithIterationTime(TimeInterval.FromMilliseconds(250)) // the default is 0.5s per iteration, which is slighlty too much for us
.WithMinIterationCount(15)
.WithMaxIterationCount(20) // we don't want to run more that 20 iterations
.AsDefault()) // tell BDN that this are our default settings
.WithArtifactsPath(artifactsPath.FullName)
.With(MemoryDiagnoser.Default) // MemoryDiagnoser is enabled by default
.With(new OperatingSystemFilter())
.With(new PartitionFilter(partitionCount, partitionIndex))
.With(JsonExporter.Full) // make sure we export to Json (for BenchView integration purpose)
.With(new PerfLabExporter())
.With(StatisticColumn.Median, StatisticColumn.Min, StatisticColumn.Max)
.With(TooManyTestCasesValidator.FailOnError)
.With(new UniqueArgumentsValidator()) // don't allow for duplicated arguments #404
.With(new MandatoryCategoryValidator(mandatoryCategories));
}
}