From 5a7bc24af82db58e486e632fd66629180c14352a Mon Sep 17 00:00:00 2001 From: Yegor Stepanov Date: Sat, 29 Oct 2022 05:54:36 +0300 Subject: [PATCH 1/5] Add slash to PowerManagement --- .../Running/PowerManagementApplier.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/BenchmarkDotNet/Running/PowerManagementApplier.cs b/src/BenchmarkDotNet/Running/PowerManagementApplier.cs index fdfa0239f5..fc7721e5fb 100644 --- a/src/BenchmarkDotNet/Running/PowerManagementApplier.cs +++ b/src/BenchmarkDotNet/Running/PowerManagementApplier.cs @@ -52,12 +52,12 @@ private void ApplyUserPowerPlan() { powerPlanChanged = false; var powerPlanFriendlyName = PowerManagementHelper.CurrentPlanFriendlyName; - logger.WriteLineInfo($"Successfully reverted power plan (GUID: {userCurrentPowerPlan.Value} FriendlyName: {powerPlanFriendlyName})"); + logger.WriteLineInfo($"// Successfully reverted power plan (GUID: {userCurrentPowerPlan.Value} FriendlyName: {powerPlanFriendlyName})"); } } catch (Exception ex) { - logger.WriteLineError($"Cannot revert power plan (error message: {ex.Message})"); + logger.WriteLineError($"// Cannot revert power plan (error message: {ex.Message})"); } } } @@ -76,15 +76,15 @@ private void ApplyPlanByGuid(Guid guid) { powerPlanChanged = true; var powerPlanFriendlyName = PowerManagementHelper.CurrentPlanFriendlyName; - logger.WriteLineInfo($"Setup power plan (GUID: {guid} FriendlyName: {powerPlanFriendlyName})"); + logger.WriteLineInfo($"// Setup power plan (GUID: {guid} FriendlyName: {powerPlanFriendlyName})"); } else - logger.WriteLineError($"Cannot setup power plan (GUID: {guid})"); + logger.WriteLineError($"// Cannot setup power plan (GUID: {guid})"); } catch (Exception ex) { - logger.WriteLineError($"Cannot setup power plan (GUID: {guid}, error message: {ex.Message})"); + logger.WriteLineError($"// Cannot setup power plan (GUID: {guid}, error message: {ex.Message})"); } } } -} +} \ No newline at end of file From 241cfc560cbd9029627f32bba3a5d8757d5a53b2 Mon Sep 17 00:00:00 2001 From: Yegor Stepanov Date: Sat, 29 Oct 2022 05:56:08 +0300 Subject: [PATCH 2/5] Improve output --- .../Validators/JitOptimizationsValidator.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/BenchmarkDotNet/Validators/JitOptimizationsValidator.cs b/src/BenchmarkDotNet/Validators/JitOptimizationsValidator.cs index 061d367d67..9cd3e5badc 100644 --- a/src/BenchmarkDotNet/Validators/JitOptimizationsValidator.cs +++ b/src/BenchmarkDotNet/Validators/JitOptimizationsValidator.cs @@ -31,8 +31,8 @@ public IEnumerable Validate(ValidationParameters validationPara yield return new ValidationError( TreatsWarningsAsErrors, $"Assembly {group.Key.GetName().Name} which defines benchmarks references non-optimized {referencedAssemblyName.Name}" + - $"{Environment.NewLine}\tIf you own this dependency, please, build it in RELEASE." + - $"{Environment.NewLine}\tIf you don't, you can disable this policy by using 'config.WithOptions(ConfigOptions.DisableOptimizationsValidator)'."); + $"{Environment.NewLine} If you own this dependency, please, build it in RELEASE." + + $"{Environment.NewLine} If you don't, you can disable this policy by using 'config.WithOptions(ConfigOptions.DisableOptimizationsValidator)'."); } } @@ -40,14 +40,14 @@ public IEnumerable Validate(ValidationParameters validationPara { yield return new ValidationError( TreatsWarningsAsErrors, - $"Assembly {group.Key.GetName().Name} which defines benchmarks is non-optimized" + Environment.NewLine + - "Benchmark was built without optimization enabled (most probably a DEBUG configuration). Please, build it in RELEASE." + Environment.NewLine + - "If you want to debug the benchmarks, please see https://benchmarkdotnet.org/articles/guides/troubleshooting.html#debugging-benchmarks." + $"Assembly {group.Key.GetName().Name} which defines benchmarks is non-optimized" + + $"{Environment.NewLine} Benchmark was built without optimization enabled (most probably a DEBUG configuration). Please, build it in RELEASE." + + $"{Environment.NewLine} If you want to debug the benchmarks, please see https://benchmarkdotnet.org/articles/guides/troubleshooting.html#debugging-benchmarks." + (group.Key.IsLinqPad() - ? Environment.NewLine + "Please enable optimizations in your LINQPad. Go to Preferences -> Query and select \"compile with /optimize+\"" + ? $"{Environment.NewLine} Please enable optimizations in your LINQPad. Go to Preferences -> Query and select \"compile with /optimize+\"" : string.Empty)); } } } } -} +} \ No newline at end of file From 0f903397211731a6193ee5109453c1cc020feaa0 Mon Sep 17 00:00:00 2001 From: Yegor Stepanov Date: Sat, 29 Oct 2022 05:56:33 +0300 Subject: [PATCH 3/5] Info -> Header --- src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs index 66a1f3d7da..b9cd2a2144 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs @@ -52,7 +52,7 @@ internal static Summary[] Run(BenchmarkRunInfo[] benchmarkRunInfos) { var compositeLogger = CreateCompositeLogger(benchmarkRunInfos, streamLogger); - compositeLogger.WriteLineInfo("// Validating benchmarks:"); + compositeLogger.WriteLineHeader("// ***** Validating benchmarks *****"); var (supportedBenchmarks, validationErrors) = GetSupportedBenchmarks(benchmarkRunInfos, resolver); From 06f470401a997dbe55cfda80e1b44ae47a74bcc7 Mon Sep 17 00:00:00 2001 From: Yegor Stepanov Date: Sat, 29 Oct 2022 05:57:02 +0300 Subject: [PATCH 4/5] Remove spaces --- src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs index b9cd2a2144..fc6268505a 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs @@ -68,7 +68,7 @@ internal static Summary[] Run(BenchmarkRunInfo[] benchmarkRunInfos) int totalBenchmarkCount = supportedBenchmarks.Sum(benchmarkInfo => benchmarkInfo.BenchmarksCases.Length); int benchmarksToRunCount = totalBenchmarkCount - (idToResume + 1); // ids are indexed from 0 - compositeLogger.WriteLineHeader("// ***** BenchmarkRunner: Start *****"); + compositeLogger.WriteLineHeader("// ***** BenchmarkRunner: Start *****"); compositeLogger.WriteLineHeader($"// ***** Found {totalBenchmarkCount} benchmark(s) in total *****"); var globalChronometer = Chronometer.Start(); @@ -267,7 +267,7 @@ private static void PrintSummary(ILogger logger, ImmutableConfig config, Summary { var cultureInfo = config.CultureInfo ?? DefaultCultureInfo.Instance; - logger.WriteLineHeader("// ***** BenchmarkRunner: Finish *****"); + logger.WriteLineHeader("// ***** BenchmarkRunner: Finish *****"); logger.WriteLine(); logger.WriteLineHeader("// * Export *"); @@ -352,7 +352,7 @@ private static ImmutableArray Validate(params BenchmarkRunInfo[ private static Dictionary BuildInParallel(ILogger logger, string rootArtifactsFolderPath, BuildPartition[] buildPartitions, in StartedClock globalChronometer) { - logger.WriteLineHeader($"// ***** Building {buildPartitions.Length} exe(s) in Parallel: Start *****"); + logger.WriteLineHeader($"// ***** Building {buildPartitions.Length} exe(s) in Parallel: Start *****"); var buildLogger = buildPartitions.Length == 1 ? logger : NullLogger.Instance; // when we have just one partition we can print to std out @@ -365,12 +365,12 @@ private static Dictionary BuildInParallel(ILogger l var afterParallelBuild = globalChronometer.GetElapsed(); - logger.WriteLineHeader($"// ***** Done, took {GetFormattedDifference(beforeParallelBuild, afterParallelBuild)} *****"); + logger.WriteLineHeader($"// ***** Done, took {GetFormattedDifference(beforeParallelBuild, afterParallelBuild)} *****"); if (buildPartitions.Length <= 1 || !buildResults.Values.Any(result => result.IsGenerateSuccess && !result.IsBuildSuccess)) return buildResults; - logger.WriteLineHeader("// ***** Failed to build in Parallel, switching to sequential build *****"); + logger.WriteLineHeader("// ***** Failed to build in Parallel, switching to sequential build *****"); foreach (var buildPartition in buildPartitions) if (buildResults[buildPartition].IsGenerateSuccess && !buildResults[buildPartition].IsBuildSuccess && !buildResults[buildPartition].TryToExplainFailureReason(out string _)) @@ -378,7 +378,7 @@ private static Dictionary BuildInParallel(ILogger l var afterSequentialBuild = globalChronometer.GetElapsed(); - logger.WriteLineHeader($"// ***** Done, took {GetFormattedDifference(afterParallelBuild, afterSequentialBuild)} *****"); + logger.WriteLineHeader($"// ***** Done, took {GetFormattedDifference(afterParallelBuild, afterSequentialBuild)} *****"); return buildResults; From 67e94f2a454db5bd75b33b57237abb413c76660d Mon Sep 17 00:00:00 2001 From: Yegor Stepanov Date: Sat, 29 Oct 2022 05:58:09 +0300 Subject: [PATCH 5/5] Remove slash with indent --- src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs index fc6268505a..aad9626ef5 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkRunnerClean.cs @@ -692,7 +692,7 @@ private static void PrintValidationErrors(ILogger logger, IEnumerable