-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathCustomBaselineClassifierColumn.cs
More file actions
36 lines (29 loc) · 1.34 KB
/
CustomBaselineClassifierColumn.cs
File metadata and controls
36 lines (29 loc) · 1.34 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
namespace Rules.Framework.BenchmarkTests
{
using System;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
internal class CustomBaselineClassifierColumn : IColumn
{
private readonly Func<BenchmarkCase, bool> classifyLogicFunc;
public CustomBaselineClassifierColumn(Func<BenchmarkCase, bool> classifyLogicFunc)
{
this.classifyLogicFunc = classifyLogicFunc;
}
public bool AlwaysShow => true;
public ColumnCategory Category => ColumnCategory.Baseline;
public string ColumnName => "Baseline";
public string Id => nameof(CustomBaselineClassifierColumn);
public bool IsNumeric => false;
public string Legend => "Sets wether a test case is a baseline.";
public int PriorityInCategory => 0;
public UnitType UnitType => UnitType.Dimensionless;
public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
=> this.classifyLogicFunc.Invoke(benchmarkCase) ? "Yes" : "No";
public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style)
=> this.GetValue(summary, benchmarkCase);
public bool IsAvailable(Summary summary) => true;
public bool IsDefault(Summary summary, BenchmarkCase benchmarkCase) => false;
}
}