Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to list all benchmarks #54

Merged
merged 2 commits into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Benchmarker/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private static void Main(string[] args)
var options = new Options();

#if RELEASE
Parser.Default.ParseArguments<Options>(args).WithParsed<Options>(opts =>
Parser.Default.ParseArguments<Options>(args).WithParsed(opts =>
{
options = opts;

Expand All @@ -42,6 +42,11 @@ private static void Main(string[] args)
}
});

if (options.ListBenchmarks)
{
Console.WriteLine(string.Join(", ", BenchmarkRunner.AvailableBenchmarks));
}

if (options?.Benchmark == null)
{
return;
Expand Down
5 changes: 5 additions & 0 deletions Benchmarking.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Dockerfile.alpine = Dockerfile.alpine
Dockerfile.arm32v7 = Dockerfile.arm32v7
Dockerfile.arm64 = Dockerfile.arm64
.github\workflows\label-manager.yml = .github\workflows\label-manager.yml
.github\labels.json = .github\labels.json
.github\workflows\netcore.yml = .github\workflows\netcore.yml
Readme.md = Readme.md
.github\workflows\secrets-checker.yml = .github\workflows\secrets-checker.yml
EndProjectSection
EndProject
Global
Expand Down
9 changes: 6 additions & 3 deletions Benchmarking/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ public class Options
[Option('t', "threads", Required = false, Default = 0, HelpText = "Manually set the number of threads to use (overrides multithreaded)")]
public int Threads { get; set; } = 1;

[Option('r', "runs", Required = false, HelpText = "Times to run the benchmark and average the result")]
[Option('r', "runs", Default = 3, HelpText = "Times to run the benchmark and average the result")]
public int Runs { get; set; } = 3;

[Option('m', "multithreaded", Required = false, HelpText = "Run benchmarks multithreaded (automatically uses all logical processors)")]
[Option('m', "multithreaded", Default = false, HelpText = "Run benchmarks multithreaded (automatically uses all logical processors)")]
public bool Multithreaded { get; set; } = false;

[Option('b', "benchmark", Required = true, HelpText = "Choose the benchmark to run")]
[Option('b', "benchmark", HelpText = "Choose the benchmark to run")]
public string Benchmark { get; set; }

[Option('l', "list-benchmarks", Default = false, HelpText = "List available benchmarks")]
public bool ListBenchmarks { get; set; }
}
}