Skip to content
Open
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
6 changes: 6 additions & 0 deletions docs/benchmarkdotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ And select one of the benchmarks from the list by either entering its number or

### Command Line

The microbenchmark `--msbuild-arguments` option passes additional arguments to MSBuild for BenchmarkDotNet's generated project. Use slash-prefixed arguments such as `/p:` or `/t:`, not `-p:` or `-t:`: `CommandLineOptions.ParseAndRemoveStringsParameter` stops collecting values at any token beginning with `-`. Embedded `--` within a `/p:` value is fine, for example:

```text
--msbuild-arguments /p:PublishReadyToRunCrossgen2ExtraArgs=--target-allows-runtime-code-generation:false
```

#### Filtering the Benchmarks

You can filter the benchmarks using `--filter $globPattern` console line argument. The filter is **case insensitive**.
Expand Down
4 changes: 4 additions & 0 deletions scripts/run_performance_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ def get_bdn_arguments(
bdn_arguments += ["\\\"--wasmArgs=--experimental-wasm-exnref\\\""]

if runtime_type == "coreclr_r2r_interpreter":
bdn_arguments += [
"--msbuild-arguments",
"/p:PublishReadyToRunCrossgen2ExtraArgs=--target-allows-runtime-code-generation:false",
]
if os_group == "windows":
bdn_arguments += [
"--runtimes", "r2r11_0",
Expand Down
5 changes: 4 additions & 1 deletion src/benchmarks/micro/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static async Task<int> Main(string[] args)
int? partitionIndex;
List<string> exclusionFilterValue;
List<string> categoryExclusionFilterValue;
List<string> msBuildArguments;
bool getDiffableDisasm;

// Parse and remove any additional parameters that we need that aren't part of BDN
Expand All @@ -31,6 +32,7 @@ static async Task<int> Main(string[] args)
argsList = CommandLineOptions.ParseAndRemoveIntParameter(argsList, "--partition-index", out partitionIndex);
argsList = CommandLineOptions.ParseAndRemoveStringsParameter(argsList, "--exclusion-filter", out exclusionFilterValue);
argsList = CommandLineOptions.ParseAndRemoveStringsParameter(argsList, "--category-exclusion-filter", out categoryExclusionFilterValue);
argsList = CommandLineOptions.ParseAndRemoveStringsParameter(argsList, "--msbuild-arguments", out msBuildArguments);
CommandLineOptions.ParseAndRemoveBooleanParameter(argsList, "--disasm-diff", out getDiffableDisasm);
Comment thread
LoopedBard3 marked this conversation as resolved.

CommandLineOptions.ValidatePartitionParameters(partitionCount, partitionIndex);
Expand All @@ -56,7 +58,8 @@ static async Task<int> Main(string[] args)
partitionIndex: partitionIndex,
exclusionFilterValue: exclusionFilterValue,
categoryExclusionFilterValue: categoryExclusionFilterValue,
getDiffableDisasm: getDiffableDisasm)
getDiffableDisasm: getDiffableDisasm,
msBuildArguments: msBuildArguments)
.AddValidator(new NoWasmValidator(Categories.NoWASM)))
.ConfigureAwait(false);

Expand Down
8 changes: 7 additions & 1 deletion src/harness/BenchmarkDotNet.Extensions/RecommendedConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public static IConfig Create(
List<string>? exclusionFilterValue = null,
List<string>? categoryExclusionFilterValue = null,
Job? job = null,
bool getDiffableDisasm = false)
bool getDiffableDisasm = false,
IReadOnlyList<string>? msBuildArguments = null)
{
if (job is null)
{
Expand All @@ -43,6 +44,11 @@ public static IConfig Create(
#pragma warning restore CS0618
}

if (msBuildArguments is not null && msBuildArguments.Count > 0)
{
job = job.WithMsBuildArguments(msBuildArguments.ToArray());
}

var config = ManualConfig.CreateEmpty()
.WithBuildTimeout(TimeSpan.FromMinutes(15)) // for slow machines
.AddLogger(ConsoleLogger.Default) // log output to console
Expand Down