Class JobColumnSelectionProvider
An alternative to DefaultColumnProviders.Job, with a user-defined selection of Job columns.
Implements
Namespace: Mawosoft.Extensions.BenchmarkDotNet
Assembly: Mawosoft.Extensions.BenchmarkDotNet.dll
Syntax
public class JobColumnSelectionProvider : Object
Constructors
JobColumnSelectionProvider(String, Boolean)
Initializes a new instance of the JobColumnSelectionProvider class.
Declaration
public JobColumnSelectionProvider(string filterExpression, bool showHiddenValuesInLegend = true)
Parameters
Type | Name | Description |
---|---|---|
String | filterExpression | A space-separated list of job column or category names, prefixed with |
Boolean | showHiddenValuesInLegend |
|
Remarks
The filter expressions are processed sequentially. Initially, all columns are visible, just
as with the default provider. The filter "-All +Job"
will first hide all job columns and then
unhide the Job name column. "-Run +RunStrategy"
will hide the columns of the Run category and
then unhide the RunStrategy column.
Each job column represents a job characteristic. Characteristics are grouped into categories,
which can be specified either by their name or by their type, e.g. Run
and RunMode
are
equivalent. Available categories are: Environment
, Gc
, Run
,
Infrastructure
, Accuracy
. For more details about them, see the
BenchmarkDotNet
documentation.
In addition, the alias All
refers to all columns, and both Job
and Id
can be used for the Job name colum.
All column and category names are case-insensitive.
Examples
Use AddColumnProvider() if you are building a config from scratch.
ManualConfig config = ManualConfig.CreateEmpty()
// Add the DefaultColumnProviders you need except DefaultColumnProviders.Job
.AddColumnProvider(DefaultColumnProviders.Descriptor /* add more... */)
// Add a new JobColumnSelectionProvider that will show only the job name
// and use the legend for hidden, non-common values.
.AddColumnProvider(new JobColumnSelectionProvider("-all +Job", true));
// Add other elements to the config...
If you are modifying an existing config, use ReplaceColumnCategory(), one of the new config extension methods in this library.
ManualConfig config = ManualConfig.Create(DefaultConfig.Instance)
// Replace the default job columns with a new JobColumnSelectionProvider
.ReplaceColumnCategory(new JobColumnSelectionProvider("-all +Job", true));
// Make other changes to the config...
If you run otherwise identical jobs with different target frameworks, you can remove redundant columns and don't need their values to be displayed in the legend.
new JobColumnSelectionProvider("-Job -Toolchain", showHiddenValuesInLegend: false)
Sample Output
- Jobs with different Run characteristics
// with JobColumnSelectionProvider("-all +Job", showHiddenValuesInLegend: true) Toolchain=InProcessEmitToolchain | Method | Job | Mean | Error | StdDev | |-------- |----------- |-----------:|----------:|----------:| | Method1 | Job-QYOJAY | 1.700 μs | 0.0100 μs | 0.0094 μs | | Method2 | Job-QYOJAY | 1.688 μs | 0.0100 μs | 0.0094 μs | | Method1 | Dry | 241.300 μs | NA | 0.0000 μs | | Method2 | Dry | 203.100 μs | NA | 0.0000 μs | Job : Job name. Some job columns have been hidden: Job-QYOJAY: IterationCount=Default, LaunchCount=Default, RunStrategy=Default, UnrollFactor=16, WarmupCount=Default Dry: IterationCount=1, LaunchCount=1, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=1 Mean : Arithmetic mean of all measurements Error : Half of 99.9% confidence interval StdDev : Standard deviation of all measurements 1 μs : 1 Microsecond (0.000001 sec)
- Jobs with different target frameworks
// with JobColumnSelectionProvider("-Job -Toolchain", showHiddenValuesInLegend: false) IterationCount=1 LaunchCount=1 RunStrategy=ColdStart UnrollFactor=1 WarmupCount=1 | Method | Runtime | Mean | Error | Ratio | |-------- |------------------- |---------:|------:|------:| | Method1 | .NET 5.0 | 435.8 μs | NA | 1.28 | | Method1 | .NET Core 3.1 | 328.7 μs | NA | 0.96 | | Method1 | .NET Framework 4.8 | 340.7 μs | NA | 1.00 | | | | | | | | Method2 | .NET 5.0 | 385.9 μs | NA | 1.15 | | Method2 | .NET Core 3.1 | 451.9 μs | NA | 1.34 | | Method2 | .NET Framework 4.8 | 336.2 μs | NA | 1.00 | Mean : Arithmetic mean of all measurements Error : Half of 99.9% confidence interval Ratio : Mean of the ratio distribution ([Current]/[Baseline]) 1 μs : 1 Microsecond (0.000001 sec)
See Also
Methods
GetColumns(Summary)
IColumnProvider implementation.
Declaration
public IEnumerable<IColumn> GetColumns(Summary summary)
Parameters
Type | Name | Description |
---|---|---|
Summary | summary |
Returns
Type | Description |
---|---|
IEnumerable<IColumn> |