-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
42 lines (36 loc) · 1.36 KB
/
Copy pathProgram.cs
File metadata and controls
42 lines (36 loc) · 1.36 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
using System.Text;
using BenchmarkDotNet.Running;
using AttributeProof.Benchmarks;
using AttributeProof.Diagnostics;
using AttributeProof.Types;
namespace AttributeProof;
/// <summary>
/// Точка входа. Без аргументов запускаются замеры, с именем отчёта — отчёт.
/// </summary>
internal static class Program
{
/// <summary>Разбор аргументов и запуск.</summary>
private static int Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
Startup.Order.Add("точка входа");
string mode = args.Length > 0 ? args[0] : string.Empty;
return mode switch
{
"checks" => Checks.Run(),
"startup" => StartupReport.Run(),
"expression" => Expressions.Run(),
_ => Bench(args),
};
}
/// <summary>Запуск замеров. Аргумент noasm выключает снятие машинного кода.</summary>
private static int Bench(string[] args)
{
bool disassembly = !args.Contains("noasm");
string[] rest = args.Where(argument => argument != "noasm").ToArray();
BenchmarkSwitcher
.FromTypes([typeof(LocalsInitBench), typeof(ArgumentBench)])
.Run(rest, new BenchmarkConfig(disassembly));
return 0;
}
}