diff --git a/src/BenchmarkDotNet/Running/PowerManagementApplier.cs b/src/BenchmarkDotNet/Running/PowerManagementApplier.cs index fdfa0239f5..52407e8066 100644 --- a/src/BenchmarkDotNet/Running/PowerManagementApplier.cs +++ b/src/BenchmarkDotNet/Running/PowerManagementApplier.cs @@ -72,6 +72,14 @@ private void ApplyPlanByGuid(Guid guid) isInitialized = true; } + Guid ultimatePerformanceGuid = PowerPlansDict[PowerPlan.UltimatePerformance]; + Guid highPerformanceGuid = PowerPlansDict[PowerPlan.HighPerformance]; + if (userCurrentPowerPlan == ultimatePerformanceGuid && guid == highPerformanceGuid) + { + logger.WriteLineInfo($"Current power plan is already Ultimate Performance. Not changing to High Performance."); + return; + } + if (PowerManagementHelper.Set(guid)) { powerPlanChanged = true; @@ -87,4 +95,4 @@ private void ApplyPlanByGuid(Guid guid) } } } -} +} \ No newline at end of file