|
| 1 | +--- |
| 2 | +uid: BenchmarkDotNet.SummaryStyle |
| 3 | +--- |
| 4 | + |
| 5 | +## SummaryStyle in BenchmarkDotNet |
| 6 | + |
| 7 | +`SummaryStyle` is a class in BenchmarkDotNet that allows customization of the summary reports of benchmark results. It offers several properties to fine-tune how the results are displayed. |
| 8 | + |
| 9 | +### Usage |
| 10 | + |
| 11 | +You can customize the summary report by specifying various properties of `SummaryStyle`. These properties include formatting options like whether to print units in the header or content, setting the maximum width for parameter columns, and choosing units for size and time measurements. |
| 12 | + |
| 13 | +### Source Code |
| 14 | + |
| 15 | +[!code-csharp[IntroSummaryStyle.cs](../../../samples/BenchmarkDotNet.Samples/IntroSummaryStyle.cs)] |
| 16 | + |
| 17 | +### Properties |
| 18 | + |
| 19 | +- `PrintUnitsInHeader`: Boolean to indicate if units should be printed in the header. |
| 20 | +- `PrintUnitsInContent`: Boolean to control unit printing in the content. |
| 21 | +- `PrintZeroValuesInContent`: Determines if zero values should be printed. |
| 22 | +- `MaxParameterColumnWidth`: Integer defining the max width for parameter columns. |
| 23 | +- `SizeUnit`: Optional `SizeUnit` to specify the unit for size measurements. |
| 24 | +- `TimeUnit`: Optional `TimeUnit` for time measurement units. |
| 25 | +- `CultureInfo`: `CultureInfo` to define culture-specific formatting. |
| 26 | + |
| 27 | +### Example Output |
| 28 | + |
| 29 | +Using SummaryStyle options: |
| 30 | + |
| 31 | +```markdown |
| 32 | +| Method | N | Mean [ns] | Error [ns] | StdDev [ns] | |
| 33 | +|------- |---- |--------------:|-----------:|------------:| |
| 34 | +| Sleep | 10 | 15,644,973.1 | 32,808.7 | 30,689.3 | |
| 35 | +| Sleep | 100 | 109,440,686.7 | 236,673.8 | 221,384.8 | |
| 36 | +``` |
| 37 | + |
| 38 | +Default: |
| 39 | + |
| 40 | +```markdown |
| 41 | +| Method | N | Mean | Error | StdDev | |
| 42 | +|------- |---- |----------:|---------:|---------:| |
| 43 | +| Sleep | 10 | 15.65 ms | 0.039 ms | 0.034 ms | |
| 44 | +| Sleep | 100 | 109.20 ms | 0.442 ms | 0.392 ms | |
| 45 | +``` |
| 46 | + |
| 47 | +### Links |
| 48 | + |
| 49 | +* @docs.SummaryStyle |
| 50 | +* The permanent link to this sample: @BenchmarkDotNet.Samples.IntroSummaryStyle |
| 51 | + |
0 commit comments