BenchmarkDotNet icon indicating copy to clipboard operation
BenchmarkDotNet copied to clipboard

chore: Update BenchmarkDotNet.Samples project

Open filzrev opened this issue 4 weeks ago • 2 comments

This PR contains following changes.

1. Add code to return exit code

Currently void Main is used, and it return ExitCode: 0 regardless validation/build/benchmark failure exists. This PR add code to return error code when failed. (Except for non-critical validation error)

2. Add Properties/launchSettings.json

Add profiles to switch settings (VisualStudio or Use --launch-profile argument). By default, Default profile is loaded. (It can be suppressed when pass --no-launch-profile)

"workingDirectory": ".", setting is added to output logs based on current directory.
(It's project directory when running on VS)

Previous behavior output logs to bin/$(Configuration)/$(TargetFramework).

3. Add code for debugging

Add dedicated config that is used when build with Debug configuration. It's expected to be used for Debugging with "Run IntroBasic Benchmarks" profile.

Note:
When target benchmark define local config with [Config(typeof(Config))].
Job is merged with ConfigUnionRule.Union rule. And it's not works as expected.
(Because both Job is executed that included GlobalConfig/LocalConfig)

filzrev avatar Dec 04 '25 21:12 filzrev

CI tests(test-macos(arm64)) failed on AllocationQuantumIsNotAnIssueForNetCore21Plus It's expected to caused by #2779 and fixed by rerun.

filzrev avatar Dec 04 '25 23:12 filzrev

I've modified code to use DebugBuildConfig/DebugInProcessConfig.

By default, DebugBuildConfig is used on Debug build. (Target benchmarks are also build with Debug configuration). When --inProcess argument is passed. It use DebugInProcessConfig instead.

Other changes

  • Add some settings that are used on DefaultConfig.
  • Add MemoryDiagnoser/ExceptionDiagnoser/ThreadingDiagnoser(Requires .NET 3.0+)
  • RunStrategy.Monitoring setting is removed from config. and need to specified as command line argument.

filzrev avatar Dec 05 '25 09:12 filzrev