Skip to content

[Bug Fix] High Performance Plan Fix #2485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MattFromRVA
Copy link
Contributor

Fixes #2319

@Alluseri
Copy link

Been 1.5 years since this PR was proposed. And yet...

@timcassell
Copy link
Collaborator

I don't think the change is robust enough. If a user explicitly configures high performance power plan, this will ignore it. It should only be ignored if it's not configured.

@MattFromRVA
Copy link
Contributor Author

Sounds good @timcassell. I will take a look at this when I have some free time.

@MattFromRVA MattFromRVA marked this pull request as draft July 16, 2025 19:23
@MattFromRVA
Copy link
Contributor Author

@timcassell Ok I have pushed my changes.

My understanding of the original intent in #2319 was to never downgrade to High Performance if the current plan is Ultimate. However, your recent comment makes sense that the code should always use the explicit power plan.

So, I’ve updated the code to only remain on Ultimate if the High Performance plan is not configured—otherwise, the requested plan will be set as expected.

Please let me know if this matches what you’re looking for.

@timcassell
Copy link
Collaborator

timcassell commented Jul 22, 2025

I can't tell what you're testing here, but it doesn't look like it's testing what a user would actually do. Users set the powerplan via Job.WithPowerPlan(...).

The benchmark runner retrieves the value and applies it here:

powerManagementApplier.ApplyPerformancePlan(benchmark.Job.Environment.PowerPlanMode
?? benchmark.Job.ResolveValue(EnvironmentMode.PowerPlanModeCharacteristic, EnvironmentResolver.Instance).GetValueOrDefault());

To check if the user explicitly set the value, you can do job.HasValue(EnvironmentMode.PowerPlanModeCharacteristic).

@MattFromRVA
Copy link
Contributor Author

@timcassell Thanks for the additional insight. Looks like I cannot properly test this change as I just realized I cannot change my laptop's settings to Ultimate. I pushed my latest commit if someone else wants to test/make changes.

if (currentPlan.HasValue && currentPlan.Value == ultimateGuid)
{
logger.WriteLineInfo("Already on Ultimate Performance; not switching to High Performance since no plan explicitly set in Job.");
continue;
Copy link
Collaborator

@timcassell timcassell Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work, you're skipping the entire benchmark here. You should rather invert the branches, or move it to another function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Pointless power plan change
3 participants