-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
49 lines (45 loc) · 1.82 KB
/
Program.cs
File metadata and controls
49 lines (45 loc) · 1.82 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
41
42
43
44
45
46
47
48
49
using System;
using System.Globalization;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Exporters.Csv;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using DapperPerfTest.PerfTest.Query;
namespace DapperPerfTest.PerfTest
{
public static class Program
{
public const string ConnectionString = "ConnectionStrings:Sql=Data Source=localhost,1434;Initial Catalog=Northwind;User Id=SA;Password=Change_Me;";
public static readonly Type[] BenchmarkTypes =
{
typeof(TimeToFirstQuery),
typeof(Select42),
typeof(Entity),
typeof(PartialEntity),
typeof(RelatedEntities)
};
private const int LoopCount = 70;
public static void Main(string[] args)
{
var customCulture = (CultureInfo)CultureInfo.InvariantCulture.Clone();
customCulture.NumberFormat.NumberGroupSeparator = string.Empty;
var exporter = new CsvExporter(
CsvSeparator.Comma,
new SummaryStyle(
customCulture,
true,
printUnitsInContent: false,
printZeroValuesInContent: true,
timeUnit: Perfolizer.Horology.TimeUnit.Millisecond,
sizeUnit: SizeUnit.B));
var config = DefaultConfig.Instance.StopOnFirstError()
.AddJob(Job.Default.WithUnrollFactor(LoopCount).WithId($"Default+Unroll{LoopCount}"))
.AddExporter(exporter)
.AddDiagnoser(new MemoryDiagnoser(new MemoryDiagnoserConfig(false)));
BenchmarkSwitcher.FromTypes(BenchmarkTypes).Run(args, config);
}
}
}