mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Explicitly save previous power limits
This commit is contained in:
@@ -299,6 +299,8 @@ namespace GHelper.AutoTDP
|
||||
tdpThread = new Thread(() =>
|
||||
{
|
||||
CurrentTDP = powerLimiter.GetCPUPowerLimit();
|
||||
powerLimiter.SavePowerLimits(); // save current power limits to restore them afterwards
|
||||
|
||||
LowestStableTDP = profile.MaxTdp;
|
||||
LowestTDP = profile.MaxTdp;
|
||||
|
||||
|
||||
@@ -13,6 +13,11 @@ namespace GHelper.AutoTDP.PowerLimiter
|
||||
private int DefaultC1 = 0;
|
||||
|
||||
public ASUSACPIPowerLimiter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SavePowerLimits()
|
||||
{
|
||||
DefaultA0 = Program.acpi.DeviceGet(AsusACPI.PPT_APUA0);
|
||||
DefaultA3 = Program.acpi.DeviceGet(AsusACPI.PPT_APUA3);
|
||||
|
||||
@@ -8,5 +8,7 @@
|
||||
|
||||
public void ResetPowerLimits();
|
||||
|
||||
public void SavePowerLimits();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,14 @@ namespace GHelper.AutoTDP.PowerLimiter
|
||||
ReadPowerUnit();
|
||||
}
|
||||
|
||||
public void SavePowerLimits()
|
||||
{
|
||||
DefaultEax = 0;
|
||||
DefaultEdx = 0;
|
||||
|
||||
ols.Rdmsr(MSR_PKG_POWER_LIMIT, ref DefaultEax, ref DefaultEdx);
|
||||
}
|
||||
|
||||
public void ReadPowerUnit()
|
||||
{
|
||||
uint eax = 0;
|
||||
@@ -72,13 +80,6 @@ namespace GHelper.AutoTDP.PowerLimiter
|
||||
|
||||
ols.Rdmsr(MSR_PKG_POWER_LIMIT, ref eax, ref edx);
|
||||
|
||||
if (DefaultEax == 0)
|
||||
{
|
||||
//Store default settings to reset them on exit
|
||||
DefaultEax = eax;
|
||||
DefaultEdx = edx;
|
||||
}
|
||||
|
||||
uint pl1 = eax & PL1_MASK;
|
||||
uint pl2 = edx & PL2_MASK;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user