Control SMT

This commit is contained in:
Kamil Trzciński 2022-11-18 21:00:52 +01:00
parent d7ad2f1d71
commit 7dc418a0e0
6 changed files with 259 additions and 32 deletions

View file

@ -1,5 +1,5 @@
using CommonHelpers;
using PowerControl.External;
using PowerControl.Helpers;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -158,6 +158,33 @@ namespace PowerControl
ApplyDelay = 1000,
Visible = false
},
new Menu.MenuItemWithOptions()
{
Name = "SMT",
ApplyDelay = 500,
Options = { "No", "Yes" },
ResetValue = () => { return "Yes"; },
CurrentValue = delegate()
{
if (!RTSS.IsOSDForeground(out var processId))
return null;
if (!ProcessorCores.HasSMTThreads())
return null;
return ProcessorCores.IsUsingSMT(processId.Value) ? "Yes" : "No";
},
ApplyValue = delegate(object selected)
{
if (!RTSS.IsOSDForeground(out var processId))
return null;
if (!ProcessorCores.HasSMTThreads())
return null;
ProcessorCores.SetProcessSMT(processId.Value, selected.ToString() == "Yes");
return ProcessorCores.IsUsingSMT(processId.Value) ? "Yes" : "No";
}
},
new Menu.MenuItemSeparator(),
new Menu.MenuItemWithOptions()
{