-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
56 lines (50 loc) · 1.96 KB
/
Copy pathProgram.cs
File metadata and controls
56 lines (50 loc) · 1.96 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
using System.Text;
using BenchmarkDotNet.Running;
using JitFoldProof.Benchmarks;
using JitFoldProof.Diagnostics;
using JitFoldProof.Types;
namespace JitFoldProof;
/// <summary>
/// Точка входа. Без аргументов запускаются замеры, с именем отчёта — отчёт.
/// Отчёты печатают в вывод, а батник перенаправляет вывод в файл.
/// </summary>
internal static class Program
{
/// <summary>Разбор аргументов и запуск.</summary>
private static int Main(string[] args)
{
// Консоль на разных машинах пишет по-разному, а отчёты уезжают
// в репозиторий одним набором.
Console.OutputEncoding = Encoding.UTF8;
string mode = args.Length > 0 ? args[0] : string.Empty;
return mode switch
{
"checks" => Checks.Run(),
"counters" => Counters.Run(),
"alloc" => Alloc.Run(),
"ilsize" => IlSize.Run(),
"warmup" => Warmup.Run(),
"timing" => Timing.Run(),
_ => Bench(args)
};
}
/// <summary>
/// Запуск замеров. Свой аргумент один — noasm, он выключает снятие
/// машинного кода. Остальные уходят в BenchmarkDotNet как есть.
/// </summary>
private static int Bench(string[] args)
{
bool disassembly = !args.Contains("noasm");
string[] rest = args.Where(argument => argument != "noasm").ToArray();
BenchmarkSwitcher
.FromTypes([
typeof(ConstantBench),
typeof(ClearBench),
typeof(GenericBench),
typeof(TierBench),
typeof(EscapeBench),
])
.Run(rest, new BenchmarkConfig(disassembly));
return 0;
}
}