Search Results for

    Show / Hide Table of Contents

    Class CombinedParamsColumn

    An alternative to DefaultColumnProviders.Params that displays all parameters in a single, customizable column.

    Inheritance
    Object
    CombinedParamsColumn
    Implements
    IColumn
    Namespace: Mawosoft.Extensions.BenchmarkDotNet
    Assembly: Mawosoft.Extensions.BenchmarkDotNet.dll
    Syntax
    public class CombinedParamsColumn : Object

    Constructors

    CombinedParamsColumn(String, String, String, String)

    Initializes a new instance of the CombinedParamsColumn class with optional custom formatting.

    Declaration
    public CombinedParamsColumn(string formatNameValue = "{0}={1}", string separator = ", ", string prefix = "", string suffix = "")
    Parameters
    Type Name Description
    String formatNameValue

    A composite format string where the format item {0} will be replaced with the parameter name and the format item {1} with the parameter value.

    The default is "{0}={1}".

    String separator

    The string to use as a separator between multiple formatted parameters. The default is ", ".

    String prefix

    The string to use before the first formatted parameter. The default is an empty string.

    String suffix

    The string to use after the last formatted parameter. The default is an empty string.

    Examples

    Use AddColumn() if you are building a config from scratch.

    ManualConfig config = ManualConfig.CreateEmpty()
        // Add the DefaultColumnProviders you need except DefaultColumnProviders.Params
        .AddColumnProvider(DefaultColumnProviders.Descriptor /* add more... */)
        // Add a new CombinedParamsColumn
        .AddColumn(new CombinedParamsColumn());
        // 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 param columns with a new CombinedParamsColumn
        .ReplaceColumnCategory(new CombinedParamsColumn());
        // Make other changes to the config...
    

    Change the formatting to display values only, separated by semicolon.

    new CombinedParamsColumn("{1}", "; ")
    
    Sample Output
    • Default Formatting
    • Custom Formatting
    • BenchmarkDotNet Defaults
    // with CombinedParamsColumn() // default formatting
    
    Job=Dry  Toolchain=InProcessEmitToolchain  IterationCount=1  
    LaunchCount=1  RunStrategy=ColdStart  UnrollFactor=1  
    WarmupCount=1  
    
    |  Method |                           Params |     Mean | Error |
    |-------- |--------------------------------- |---------:|------:|
    | Method1 |   fooArg=fooval1, barArg=barval1 | 382.9 μs |    NA |
    | Method2 |   fooArg=fooval1, bazArg=bazval1 | 255.3 μs |    NA |
    | Method3 | fooArg=fooval1, buzzArg=buzzval1 | 255.8 μs |    NA |
    | Method1 |   fooArg=fooval2, barArg=barval2 | 262.6 μs |    NA |
    | Method2 |   fooArg=fooval2, bazArg=bazval2 | 268.5 μs |    NA |
    | Method3 | fooArg=fooval2, buzzArg=buzzval2 | 256.6 μs |    NA |
    
      Params : All parameter values
      Mean   : Arithmetic mean of all measurements
      Error  : Half of 99.9% confidence interval
      1 μs   : 1 Microsecond (0.000001 sec)
    
    // with CombinedParamsColumn(formatNameValue: "{1}", separator: "; ")
    
    Job=Dry  Toolchain=InProcessEmitToolchain  IterationCount=1  
    LaunchCount=1  RunStrategy=ColdStart  UnrollFactor=1  
    WarmupCount=1  
    
    |  Method |            Params |     Mean | Error |
    |-------- |------------------ |---------:|------:|
    | Method1 |  fooval1; barval1 | 272.2 μs |    NA |
    | Method2 |  fooval1; bazval1 | 272.0 μs |    NA |
    | Method3 | fooval1; buzzval1 | 280.2 μs |    NA |
    | Method1 |  fooval2; barval2 | 255.9 μs |    NA |
    | Method2 |  fooval2; bazval2 | 371.8 μs |    NA |
    | Method3 | fooval2; buzzval2 | 267.3 μs |    NA |
    
      Params : All parameter values
      Mean   : Arithmetic mean of all measurements
      Error  : Half of 99.9% confidence interval
      1 μs   : 1 Microsecond (0.000001 sec)
    
    // with BenchmarkDotNet defaults
    
    Job=Dry  Toolchain=InProcessEmitToolchain  IterationCount=1  
    LaunchCount=1  RunStrategy=ColdStart  UnrollFactor=1  
    WarmupCount=1  
    
    |  Method |  fooArg |  barArg |  bazArg |  buzzArg |     Mean | Error |
    |-------- |-------- |-------- |-------- |--------- |---------:|------:|
    | Method1 | fooval1 | barval1 |       ? |        ? | 410.8 μs |    NA |
    | Method2 | fooval1 |       ? | bazval1 |        ? | 325.0 μs |    NA |
    | Method3 | fooval1 |       ? |       ? | buzzval1 | 341.0 μs |    NA |
    | Method1 | fooval2 | barval2 |       ? |        ? | 268.8 μs |    NA |
    | Method2 | fooval2 |       ? | bazval2 |        ? | 310.9 μs |    NA |
    | Method3 | fooval2 |       ? |       ? | buzzval2 | 414.2 μs |    NA |
    
      fooArg  : Value of the 'fooArg' parameter
      barArg  : Value of the 'barArg' parameter
      bazArg  : Value of the 'bazArg' parameter
      buzzArg : Value of the 'buzzArg' parameter
      Mean    : Arithmetic mean of all measurements
      Error   : Half of 99.9% confidence interval
      1 μs    : 1 Microsecond (0.000001 sec)
    
    See Also
    Column Display Samples on GitHub

    Properties

    AlwaysShow

    IColumn implementation.

    Declaration
    public bool AlwaysShow { get; }
    Property Value
    Type Description
    Boolean

    Category

    IColumn implementation.

    Declaration
    public ColumnCategory Category { get; }
    Property Value
    Type Description
    ColumnCategory

    ColumnName

    IColumn implementation.

    Declaration
    public string ColumnName { get; }
    Property Value
    Type Description
    String

    Id

    IColumn implementation.

    Declaration
    public string Id { get; }
    Property Value
    Type Description
    String

    IsNumeric

    IColumn implementation.

    Declaration
    public bool IsNumeric { get; }
    Property Value
    Type Description
    Boolean

    Legend

    IColumn implementation.

    Declaration
    public string Legend { get; }
    Property Value
    Type Description
    String

    PriorityInCategory

    IColumn implementation.

    Declaration
    public int PriorityInCategory { get; }
    Property Value
    Type Description
    Int32

    UnitType

    IColumn implementation.

    Declaration
    public UnitType UnitType { get; }
    Property Value
    Type Description
    UnitType

    Methods

    GetValue(Summary, BenchmarkCase)

    IColumn implementation.

    Declaration
    public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
    Parameters
    Type Name Description
    Summary summary
    BenchmarkCase benchmarkCase
    Returns
    Type Description
    String

    GetValue(Summary, BenchmarkCase, SummaryStyle)

    IColumn implementation.

    Declaration
    public string GetValue(Summary summary, BenchmarkCase benchmarkCase, SummaryStyle style)
    Parameters
    Type Name Description
    Summary summary
    BenchmarkCase benchmarkCase
    SummaryStyle style
    Returns
    Type Description
    String

    IsAvailable(Summary)

    IColumn implementation.

    Declaration
    public bool IsAvailable(Summary summary)
    Parameters
    Type Name Description
    Summary summary
    Returns
    Type Description
    Boolean

    IsDefault(Summary, BenchmarkCase)

    IColumn implementation.

    Declaration
    public bool IsDefault(Summary summary, BenchmarkCase benchmarkCase)
    Parameters
    Type Name Description
    Summary summary
    BenchmarkCase benchmarkCase
    Returns
    Type Description
    Boolean

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    Implements

    IColumn
    In This Article
    Back to top Copyright © 2021-2023 Matthias Wolf, Mawosoft