Added --debug switch to benchmarks.

To be able to run benchmarks in the debugger, you need to pass `DebugInProcessConfig` to the benchmark switcher. There doesn't seem to be any inbuilt switch to enable this from the command-line, so added one to the benchmarks projects in order to be able to debug benchmarks more easily.
This commit is contained in:
Steven Kirk
2022-07-13 12:16:48 +02:00
parent e9aa43e941
commit af0014b735
+13 -1
View File
@@ -1,6 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
namespace Avalonia.Benchmarks
@@ -19,7 +21,17 @@ namespace Avalonia.Benchmarks
.ThenBy(t => t.Name)
.ToArray();
var benchmarkSwitcher = new BenchmarkSwitcher(benchmarks);
benchmarkSwitcher.Run(args);
IConfig config = null;
if (args.Contains("--debug"))
{
config = new DebugInProcessConfig();
var a = new List<string>(args);
a.Remove("--debug");
args = a.ToArray();
}
benchmarkSwitcher.Run(args, config);
}
}
}