Sample: IntroJoin
If you are using BenchmarkSwitcher
and want to run all the benchmarks with a category from all types and join them into one summary table, use the --join
option (or BenchmarkSwitcher.RunAllJoined
):
Source code
using System.Threading;
using BenchmarkDotNet.Attributes;
namespace BenchmarkDotNet.Samples
{
// Run BenchmarkSwitcher with arguments: "--join --category=IntroJoinA"
[DryJob]
public class IntroJoin1
{
[Benchmark]
[BenchmarkCategory("IntroJoinA")]
public void A() => Thread.Sleep(10);
[Benchmark]
[BenchmarkCategory("IntroJoinB")]
public void B() => Thread.Sleep(10);
}
[DryJob]
public class IntroJoin2
{
[Benchmark]
[BenchmarkCategory("IntroJoinA")]
public void A() => Thread.Sleep(10);
[Benchmark]
[BenchmarkCategory("IntroJoinB")]
public void B() => Thread.Sleep(10);
}
}
Command line
--join --allCategories=IntroJoinA
Output
| Type | Method | Mean | Error |
|----------- |------- |---------:|------:|
| IntroJoin1 | A | 10.99 ms | NA |
| IntroJoin2 | A | 12.50 ms | NA |
Links
- Filters
- The permanent link to this sample: BenchmarkDotNet.Samples.IntroJoin