From b8e45474dd378671b582bf7854d4a89166932abb Mon Sep 17 00:00:00 2001 From: Johannes Deml Date: Tue, 4 Apr 2023 21:14:27 +0200 Subject: [PATCH] Fix manual config setup Minimal config is now used as the base, therefore no columns are defined twice --- .../PredefinedBenchmarks/Config/ConfigHelper.cs | 2 +- .../PredefinedBenchmarks/Config/PerformanceBenchmarkConfig.cs | 2 -- .../PredefinedBenchmarks/Config/QuickBenchmarkConfig.cs | 2 -- .../PredefinedBenchmarks/Config/SamplingBenchmarkConfig.cs | 2 -- NetworkBenchmarkDotNet/Program.cs | 4 +++- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/ConfigHelper.cs b/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/ConfigHelper.cs index 2b2ff93..b49eb51 100644 --- a/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/ConfigHelper.cs +++ b/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/ConfigHelper.cs @@ -26,7 +26,7 @@ public static class ConfigHelper /// * units stay the same /// * No units in cell data (Always numbers) /// - public static readonly SummaryStyle CsvStyle = new SummaryStyle(CultureInfo.InvariantCulture, false, SizeUnit.KB, TimeUnit.Millisecond, + private static readonly SummaryStyle CsvStyle = new SummaryStyle(CultureInfo.InvariantCulture, false, SizeUnit.KB, TimeUnit.Millisecond, false, true, 100); public static void AddDefaultColumns(ManualConfig config) diff --git a/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/PerformanceBenchmarkConfig.cs b/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/PerformanceBenchmarkConfig.cs index fe06b96..ad0d6f4 100644 --- a/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/PerformanceBenchmarkConfig.cs +++ b/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/PerformanceBenchmarkConfig.cs @@ -18,8 +18,6 @@ public class PerformanceBenchmarkConfig : ManualConfig { public PerformanceBenchmarkConfig() { - Add(DefaultConfig.Instance); - Job baseJob = Job.Default .WithLaunchCount(1) .WithWarmupCount(1) diff --git a/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/QuickBenchmarkConfig.cs b/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/QuickBenchmarkConfig.cs index cd6b849..34d8f94 100644 --- a/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/QuickBenchmarkConfig.cs +++ b/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/QuickBenchmarkConfig.cs @@ -19,8 +19,6 @@ public class QuickBenchmarkConfig : ManualConfig { public QuickBenchmarkConfig() { - Add(DefaultConfig.Instance); - Job baseJob = Job.Default .WithStrategy(RunStrategy.Monitoring) .WithLaunchCount(1) diff --git a/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/SamplingBenchmarkConfig.cs b/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/SamplingBenchmarkConfig.cs index 2cc7273..7557aed 100644 --- a/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/SamplingBenchmarkConfig.cs +++ b/NetworkBenchmarkDotNet/PredefinedBenchmarks/Config/SamplingBenchmarkConfig.cs @@ -22,8 +22,6 @@ public class SamplingBenchmarkConfig : ManualConfig { public SamplingBenchmarkConfig() { - Add(DefaultConfig.Instance); - Job baseJob = Job.Default .WithLaunchCount(1) .WithWarmupCount(1) diff --git a/NetworkBenchmarkDotNet/Program.cs b/NetworkBenchmarkDotNet/Program.cs index 06c82aa..8d07a66 100644 --- a/NetworkBenchmarkDotNet/Program.cs +++ b/NetworkBenchmarkDotNet/Program.cs @@ -12,6 +12,7 @@ using System.CommandLine; using System.CommandLine.Invocation; using System.Linq; +using BenchmarkDotNet.Configs; using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; @@ -103,7 +104,8 @@ private static void RunCustomBenchmark() /// Type of the benchmark to run private static void RunBenchmark() { - var summary = BenchmarkRunner.Run(); + ManualConfig config = ManualConfig.CreateMinimumViable(); + var summary = BenchmarkRunner.Run(config); Assert(!summary.HasCriticalValidationErrors, "The \"Summary\" should have NOT \"HasCriticalValidationErrors\"");