-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathProgram.cs
More file actions
40 lines (34 loc) · 1.37 KB
/
Copy pathProgram.cs
File metadata and controls
40 lines (34 loc) · 1.37 KB
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
34
35
36
37
38
39
40
using System;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
namespace Light.GuardClauses.Performance;
public static class Program
{
private const string EnableDisassemblyOption = "--enable-disassembly";
private static IConfig CreateConfiguration(bool enableDisassembly)
{
var configuration = DefaultConfig
.Instance
.AddJob(Job.Default.WithRuntime(CoreRuntime.Core10_0))
.AddDiagnoser(MemoryDiagnoser.Default);
return enableDisassembly ?
configuration.AddDiagnoser(new DisassemblyDiagnoser(new DisassemblyDiagnoserConfig())) :
configuration;
}
public static void Main(string[] arguments)
{
var enableDisassembly = Array.Exists(
arguments,
argument => string.Equals(argument, EnableDisassemblyOption, StringComparison.OrdinalIgnoreCase)
);
var benchmarkArguments = Array.FindAll(
arguments,
argument => !string.Equals(argument, EnableDisassemblyOption, StringComparison.OrdinalIgnoreCase)
);
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly)
.Run(benchmarkArguments, CreateConfiguration(enableDisassembly));
}
}