-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathJob.cs
More file actions
86 lines (71 loc) · 4.18 KB
/
Copy pathJob.cs
File metadata and controls
86 lines (71 loc) · 4.18 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using BenchmarkDotNet.Characteristics;
using JetBrains.Annotations;
using System;
using System.Diagnostics.CodeAnalysis;
namespace BenchmarkDotNet.Jobs
{
[SuppressMessage("ReSharper", "UnassignedReadonlyField")]
public sealed class Job : JobMode<Job>
{
[PublicAPI] public static readonly Characteristic<EnvironmentMode> EnvironmentCharacteristic = CreateCharacteristic<EnvironmentMode>(nameof(Environment));
[PublicAPI] public static readonly Characteristic<RunMode> RunCharacteristic = CreateCharacteristic<RunMode>(nameof(Run));
[PublicAPI] public static readonly Characteristic<InfrastructureMode> InfrastructureCharacteristic = CreateCharacteristic<InfrastructureMode>(nameof(Infrastructure));
[PublicAPI] public static readonly Characteristic<AccuracyMode> AccuracyCharacteristic = CreateCharacteristic<AccuracyMode>(nameof(Accuracy));
[PublicAPI] public static readonly Characteristic<MetaMode> MetaCharacteristic = CreateCharacteristic<MetaMode>(nameof(Meta));
internal static readonly Characteristic<bool> ImplicitIdCharacteristic = CreateHiddenCharacteristic<bool>("ImplicitId");
public static readonly Job LegacyJitX86 = new Job(EnvironmentMode.LegacyJitX86).WithImplicitId(nameof(LegacyJitX86)).Freeze();
public static readonly Job LegacyJitX64 = new Job(EnvironmentMode.LegacyJitX64).WithImplicitId(nameof(LegacyJitX64)).Freeze();
public static readonly Job RyuJitX64 = new Job(EnvironmentMode.RyuJitX64).WithImplicitId(nameof(RyuJitX64)).Freeze();
public static readonly Job RyuJitX86 = new Job(EnvironmentMode.RyuJitX86).WithImplicitId(nameof(RyuJitX86)).Freeze();
// Run
public static readonly Job Dry = new Job(RunMode.Dry).WithImplicitId(nameof(Dry)).Freeze();
public static readonly Job ShortRun = new Job(RunMode.Short).WithImplicitId(nameof(ShortRun)).Freeze();
public static readonly Job MediumRun = new Job(RunMode.Medium).WithImplicitId(nameof(MediumRun)).Freeze();
public static readonly Job LongRun = new Job(RunMode.Long).WithImplicitId(nameof(LongRun)).Freeze();
public static readonly Job VeryLongRun = new Job(RunMode.VeryLong).WithImplicitId(nameof(VeryLongRun)).Freeze();
// Infrastructure
public static readonly Job InProcess = new Job(InfrastructureMode.InProcess).WithImplicitId(nameof(InProcess));
public static readonly Job InProcessDontLogOutput = new Job(InfrastructureMode.InProcessDontLogOutput).WithImplicitId(nameof(InProcessDontLogOutput));
public Job() : this((string)null) { }
public Job(string id) : base(id)
{
EnvironmentCharacteristic[this] = new EnvironmentMode();
RunCharacteristic[this] = new RunMode();
InfrastructureCharacteristic[this] = new InfrastructureMode();
AccuracyCharacteristic[this] = new AccuracyMode();
MetaCharacteristic[this] = new MetaMode();
ImplicitIdCharacteristic[this] = false;
}
public Job(CharacteristicObject other) : this((string)null, other)
{
}
public Job(params CharacteristicObject[] others) : this(null, others)
{
}
public Job(string id, CharacteristicObject other) : this(id)
{
Apply(other);
}
public Job(string id, params CharacteristicObject[] others) : this(id)
{
Apply(others);
}
public EnvironmentMode Environment => EnvironmentCharacteristic[this];
public RunMode Run => RunCharacteristic[this];
public InfrastructureMode Infrastructure => InfrastructureCharacteristic[this];
public AccuracyMode Accuracy => AccuracyCharacteristic[this];
public MetaMode Meta => MetaCharacteristic[this];
public string ResolvedId => HasValue(IdCharacteristic) ? Id : JobIdGenerator.GenerateRandomId(this);
public string FolderInfo => ResolvedId;
public string DisplayInfo
{
get
{
string props = ResolveId(this, null);
return props == IdCharacteristic.FallbackValue
? ResolvedId
: ResolvedId + $"({props})";
}
}
}
}