-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
41 lines (35 loc) · 1.3 KB
/
Copy pathProgram.cs
File metadata and controls
41 lines (35 loc) · 1.3 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
using System.Text;
using BenchmarkDotNet.Running;
using OverflowProof.Benchmarks;
using OverflowProof.Diagnostics;
using OverflowProof.Types;
namespace OverflowProof;
/// <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(),
"numbers" => Numbers.Run(),
"search" => Search.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(CheckedBench), typeof(MidpointBench), typeof(AbsBench)])
.Run(rest, new BenchmarkConfig(disassembly));
return 0;
}
}