-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
40 lines (34 loc) · 1.24 KB
/
Copy pathProgram.cs
File metadata and controls
40 lines (34 loc) · 1.24 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
using System.Text;
using BenchmarkDotNet.Running;
using KeyHashProof.Benchmarks;
using KeyHashProof.Diagnostics;
using KeyHashProof.Types;
namespace KeyHashProof;
/// <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(),
"hashes" => Hashes.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(LookupBench), typeof(BuildBench)])
.Run(rest, new BenchmarkConfig(disassembly));
return 0;
}
}