mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
InitMaxGPUPower
This commit is contained in:
@@ -154,7 +154,7 @@ public class AsusACPI
|
||||
public static int MaxGPUBoost = 25;
|
||||
|
||||
public static int MinGPUPower = 0;
|
||||
public static int MaxGPUPower = 60;
|
||||
public static int MaxGPUPower = 70;
|
||||
|
||||
public const int MinGPUTemp = 75;
|
||||
public const int MaxGPUTemp = 87;
|
||||
@@ -291,12 +291,6 @@ public class AsusACPI
|
||||
if (AppConfig.IsIntelHX())
|
||||
{
|
||||
MaxTotal = 175;
|
||||
MaxGPUPower = 70;
|
||||
}
|
||||
|
||||
if (AppConfig.IsSlash())
|
||||
{
|
||||
MaxGPUPower = AppConfig.Get("max_gpu_power", 25);
|
||||
}
|
||||
|
||||
if (AppConfig.DynamicBoost5())
|
||||
|
||||
16
app/Fans.cs
16
app/Fans.cs
@@ -32,6 +32,7 @@ namespace GHelper
|
||||
FanSensorControl fanSensorControl;
|
||||
|
||||
static int gpuPowerBase = 0;
|
||||
static bool isGPUPower => gpuPowerBase > 0;
|
||||
|
||||
public Fans()
|
||||
{
|
||||
@@ -526,8 +527,16 @@ namespace GHelper
|
||||
private void InitGPUPower()
|
||||
{
|
||||
gpuPowerBase = Program.acpi.DeviceGet(AsusACPI.GPU_BASE);
|
||||
panelGPUPower.Visible = gpuPowerBase > 0;
|
||||
if (gpuPowerBase <= 0) return;
|
||||
panelGPUPower.Visible = isGPUPower;
|
||||
if (!isGPUPower) return;
|
||||
|
||||
int maxGPUPower = NvidiaSmi.GetMaxGPUPower();
|
||||
if (maxGPUPower > 0)
|
||||
{
|
||||
AsusACPI.MaxGPUPower = maxGPUPower - gpuPowerBase - 15;
|
||||
trackGPUPower.Minimum = AsusACPI.MinGPUPower;
|
||||
trackGPUPower.Maximum = AsusACPI.MaxGPUPower;
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
@@ -678,7 +687,8 @@ namespace GHelper
|
||||
{
|
||||
AppConfig.SetMode("gpu_boost", trackGPUBoost.Value);
|
||||
AppConfig.SetMode("gpu_temp", trackGPUTemp.Value);
|
||||
AppConfig.SetMode("gpu_power", trackGPUPower.Value);
|
||||
|
||||
if (isGPUPower) AppConfig.SetMode("gpu_power", trackGPUPower.Value);
|
||||
|
||||
VisualiseGPUSettings();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,20 @@ public static class NvidiaSmi
|
||||
return false; // Return false if the "Display Active" status is not found
|
||||
}
|
||||
|
||||
public static int GetMaxGPUPower()
|
||||
{
|
||||
string output = RunNvidiaSmiCommand("--query-gpu=power.max_limit --format csv,noheader,nounits");
|
||||
output = output.Trim().Trim('\n', '\r');
|
||||
|
||||
if (float.TryParse(output, out float floatValue))
|
||||
{
|
||||
int intValue = (int)floatValue;
|
||||
return intValue;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static string RunNvidiaSmiCommand(string arguments = "-i 0 -q")
|
||||
{
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo
|
||||
|
||||
Reference in New Issue
Block a user