-
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathProgram.cs
More file actions
53 lines (47 loc) · 1.82 KB
/
Program.cs
File metadata and controls
53 lines (47 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
50
51
52
53
using Benchmark;
using Benchmark.Notification;
using Benchmark.SendRequest;
using Benchmark.StreamRequest;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
BenchmarkSwitcher.FromTypes([
typeof(MediatRVsDispatchBenchmark),
typeof(MediatRVsDispatchWithPipelineRBenchmark),
typeof(StreamMediatRVsDispatchBenchmark),
typeof(StreamMediatRVsDispatchWithPipelineRBenchmark),
typeof(NotificationBenchmarks),
]).Run(args, ManualConfig.Create(DefaultConfig.Instance)
.AddColumn(new OperationsColumn())
);
namespace Benchmark
{
public class OperationsColumn : IColumn
{
public string Id => nameof(OperationsColumn);
public string ColumnName => "OpsCount";
public bool AlwaysShow => true;
public ColumnCategory Category => ColumnCategory.Custom;
public int PriorityInCategory => -10;
public bool IsNumeric => true;
public UnitType UnitType => UnitType.Dimensionless;
public string Legend => "Number of operations per invoke";
public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
{
return benchmarkCase.Descriptor.WorkloadMethod
.GetCustomAttributes(typeof(BenchmarkAttribute), false)
.Cast<BenchmarkAttribute>()
.FirstOrDefault()?.OperationsPerInvoke.ToString() ?? "1";
}
public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style)
=> GetValue(summary, benchmarkCase);
public bool IsDefault(Summary summary, BenchmarkCase benchmarkCase)
{
return true;
}
public bool IsAvailable(Summary summary) => true;
public bool IsDefault(Summary summary) => false;
}
}