From 3437889f5ffcb34faa385adc0bfd9f9f537dc179 Mon Sep 17 00:00:00 2001 From: Matt Chaulklin Date: Fri, 15 Dec 2023 15:26:59 -0500 Subject: [PATCH] Fixes #2319 --- src/BenchmarkDotNet/Running/PowerManagementApplier.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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