mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
GPU Clock Limiting
This commit is contained in:
@@ -348,7 +348,8 @@ public static class AppConfig
|
||||
return
|
||||
Is("manual_mode") ||
|
||||
ContainsModel("GU604") ||
|
||||
ContainsModel("G733");
|
||||
ContainsModel("G733") ||
|
||||
ContainsModel("FX507Z");
|
||||
}
|
||||
|
||||
public static bool IsFanRequired()
|
||||
|
||||
210
app/Fans.Designer.cs
generated
210
app/Fans.Designer.cs
generated
@@ -103,11 +103,14 @@ namespace GHelper
|
||||
pictureBoxCPU = new PictureBox();
|
||||
labelPowerLimits = new Label();
|
||||
panelBoost = new Panel();
|
||||
panelPowerMode = new Panel();
|
||||
comboPowerMode = new RComboBox();
|
||||
panelBoostTitle = new Panel();
|
||||
pictureBoost = new PictureBox();
|
||||
labelBoost = new Label();
|
||||
panelPowerMode = new Panel();
|
||||
comboPowerMode = new RComboBox();
|
||||
panelPowerModeTItle = new Panel();
|
||||
picturePowerMode = new PictureBox();
|
||||
labelPowerModeTitle = new Label();
|
||||
panelGPU = new Panel();
|
||||
panelGPUTemp = new Panel();
|
||||
labelGPUTemp = new Label();
|
||||
@@ -133,9 +136,10 @@ namespace GHelper
|
||||
buttonAdvanced = new RButton();
|
||||
buttonGPU = new RButton();
|
||||
buttonCPU = new RButton();
|
||||
panelPowerModeTItle = new Panel();
|
||||
picturePowerMode = new PictureBox();
|
||||
labelPowerModeTitle = new Label();
|
||||
panelGPUClockLimit = new Panel();
|
||||
labelGPUClockLimit = new Label();
|
||||
trackGPUClockLimit = new TrackBar();
|
||||
labelGPUClockLimitTitle = new Label();
|
||||
panelFans.SuspendLayout();
|
||||
tableFanCharts.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
|
||||
@@ -170,9 +174,11 @@ namespace GHelper
|
||||
panelTitleCPU.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCPU).BeginInit();
|
||||
panelBoost.SuspendLayout();
|
||||
panelPowerMode.SuspendLayout();
|
||||
panelBoostTitle.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoost).BeginInit();
|
||||
panelPowerMode.SuspendLayout();
|
||||
panelPowerModeTItle.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)picturePowerMode).BeginInit();
|
||||
panelGPU.SuspendLayout();
|
||||
panelGPUTemp.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)trackGPUTemp).BeginInit();
|
||||
@@ -186,8 +192,8 @@ namespace GHelper
|
||||
((System.ComponentModel.ISupportInitialize)pictureGPU).BeginInit();
|
||||
panelNav.SuspendLayout();
|
||||
tableNav.SuspendLayout();
|
||||
panelPowerModeTItle.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)picturePowerMode).BeginInit();
|
||||
panelGPUClockLimit.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)trackGPUClockLimit).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panelFans
|
||||
@@ -499,7 +505,7 @@ namespace GHelper
|
||||
panelAdvanced.Controls.Add(panelTemperature);
|
||||
panelAdvanced.Controls.Add(panelTitleTemp);
|
||||
panelAdvanced.Dock = DockStyle.Top;
|
||||
panelAdvanced.Location = new Point(10, 1396);
|
||||
panelAdvanced.Location = new Point(10, 1520);
|
||||
panelAdvanced.Name = "panelAdvanced";
|
||||
panelAdvanced.Size = new Size(520, 888);
|
||||
panelAdvanced.TabIndex = 14;
|
||||
@@ -797,7 +803,7 @@ namespace GHelper
|
||||
panelPower.Controls.Add(panelPowerMode);
|
||||
panelPower.Controls.Add(panelPowerModeTItle);
|
||||
panelPower.Dock = DockStyle.Top;
|
||||
panelPower.Location = new Point(10, 640);
|
||||
panelPower.Location = new Point(10, 764);
|
||||
panelPower.Margin = new Padding(4);
|
||||
panelPower.Name = "panelPower";
|
||||
panelPower.Size = new Size(520, 756);
|
||||
@@ -1020,30 +1026,6 @@ namespace GHelper
|
||||
panelBoost.Size = new Size(520, 64);
|
||||
panelBoost.TabIndex = 13;
|
||||
//
|
||||
// panelPowerMode
|
||||
//
|
||||
panelPowerMode.Controls.Add(comboPowerMode);
|
||||
panelPowerMode.Dock = DockStyle.Top;
|
||||
panelPowerMode.Location = new Point(0, 60);
|
||||
panelPowerMode.Margin = new Padding(4);
|
||||
panelPowerMode.Name = "panelPowerMode";
|
||||
panelPowerMode.Size = new Size(520, 64);
|
||||
panelPowerMode.TabIndex = 49;
|
||||
//
|
||||
// comboPowerMode
|
||||
//
|
||||
comboPowerMode.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboPowerMode.BorderColor = Color.White;
|
||||
comboPowerMode.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboPowerMode.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboPowerMode.FormattingEnabled = true;
|
||||
comboPowerMode.Items.AddRange(new object[] { "Disabled", "Enabled", "Aggressive", "Efficient Enabled", "Efficient Aggressive", "Aggressive at Guaranteed", "Efficient at Guaranteed" });
|
||||
comboPowerMode.Location = new Point(13, 12);
|
||||
comboPowerMode.Margin = new Padding(4);
|
||||
comboPowerMode.Name = "comboPowerMode";
|
||||
comboPowerMode.Size = new Size(329, 40);
|
||||
comboPowerMode.TabIndex = 42;
|
||||
//
|
||||
// panelBoostTitle
|
||||
//
|
||||
panelBoostTitle.AutoSize = true;
|
||||
@@ -1080,6 +1062,66 @@ namespace GHelper
|
||||
labelBoost.TabIndex = 39;
|
||||
labelBoost.Text = "CPU Boost";
|
||||
//
|
||||
// panelPowerMode
|
||||
//
|
||||
panelPowerMode.Controls.Add(comboPowerMode);
|
||||
panelPowerMode.Dock = DockStyle.Top;
|
||||
panelPowerMode.Location = new Point(0, 60);
|
||||
panelPowerMode.Margin = new Padding(4);
|
||||
panelPowerMode.Name = "panelPowerMode";
|
||||
panelPowerMode.Size = new Size(520, 64);
|
||||
panelPowerMode.TabIndex = 49;
|
||||
//
|
||||
// comboPowerMode
|
||||
//
|
||||
comboPowerMode.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboPowerMode.BorderColor = Color.White;
|
||||
comboPowerMode.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||
comboPowerMode.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboPowerMode.FormattingEnabled = true;
|
||||
comboPowerMode.Items.AddRange(new object[] { "Disabled", "Enabled", "Aggressive", "Efficient Enabled", "Efficient Aggressive", "Aggressive at Guaranteed", "Efficient at Guaranteed" });
|
||||
comboPowerMode.Location = new Point(13, 12);
|
||||
comboPowerMode.Margin = new Padding(4);
|
||||
comboPowerMode.Name = "comboPowerMode";
|
||||
comboPowerMode.Size = new Size(329, 40);
|
||||
comboPowerMode.TabIndex = 42;
|
||||
//
|
||||
// panelPowerModeTItle
|
||||
//
|
||||
panelPowerModeTItle.AutoSize = true;
|
||||
panelPowerModeTItle.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelPowerModeTItle.Controls.Add(picturePowerMode);
|
||||
panelPowerModeTItle.Controls.Add(labelPowerModeTitle);
|
||||
panelPowerModeTItle.Dock = DockStyle.Top;
|
||||
panelPowerModeTItle.Location = new Point(0, 0);
|
||||
panelPowerModeTItle.Margin = new Padding(4);
|
||||
panelPowerModeTItle.Name = "panelPowerModeTItle";
|
||||
panelPowerModeTItle.Size = new Size(520, 60);
|
||||
panelPowerModeTItle.TabIndex = 50;
|
||||
//
|
||||
// picturePowerMode
|
||||
//
|
||||
picturePowerMode.BackgroundImage = Properties.Resources.icons8_gauge_32;
|
||||
picturePowerMode.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
picturePowerMode.InitialImage = null;
|
||||
picturePowerMode.Location = new Point(10, 18);
|
||||
picturePowerMode.Margin = new Padding(4, 2, 4, 10);
|
||||
picturePowerMode.Name = "picturePowerMode";
|
||||
picturePowerMode.Size = new Size(32, 32);
|
||||
picturePowerMode.TabIndex = 40;
|
||||
picturePowerMode.TabStop = false;
|
||||
//
|
||||
// labelPowerModeTitle
|
||||
//
|
||||
labelPowerModeTitle.AutoSize = true;
|
||||
labelPowerModeTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelPowerModeTitle.Location = new Point(46, 18);
|
||||
labelPowerModeTitle.Margin = new Padding(4, 0, 4, 0);
|
||||
labelPowerModeTitle.Name = "labelPowerModeTitle";
|
||||
labelPowerModeTitle.Size = new Size(271, 32);
|
||||
labelPowerModeTitle.TabIndex = 39;
|
||||
labelPowerModeTitle.Text = "Windows Power Mode";
|
||||
//
|
||||
// panelGPU
|
||||
//
|
||||
panelGPU.AutoSize = true;
|
||||
@@ -1087,13 +1129,14 @@ namespace GHelper
|
||||
panelGPU.Controls.Add(panelGPUBoost);
|
||||
panelGPU.Controls.Add(panelGPUMemory);
|
||||
panelGPU.Controls.Add(panelGPUCore);
|
||||
panelGPU.Controls.Add(panelGPUClockLimit);
|
||||
panelGPU.Controls.Add(panelTitleGPU);
|
||||
panelGPU.Dock = DockStyle.Top;
|
||||
panelGPU.Location = new Point(10, 66);
|
||||
panelGPU.Margin = new Padding(4);
|
||||
panelGPU.Name = "panelGPU";
|
||||
panelGPU.Padding = new Padding(0, 0, 0, 18);
|
||||
panelGPU.Size = new Size(520, 574);
|
||||
panelGPU.Size = new Size(520, 698);
|
||||
panelGPU.TabIndex = 44;
|
||||
panelGPU.Visible = false;
|
||||
//
|
||||
@@ -1105,7 +1148,7 @@ namespace GHelper
|
||||
panelGPUTemp.Controls.Add(labelGPUTempTitle);
|
||||
panelGPUTemp.Controls.Add(trackGPUTemp);
|
||||
panelGPUTemp.Dock = DockStyle.Top;
|
||||
panelGPUTemp.Location = new Point(0, 432);
|
||||
panelGPUTemp.Location = new Point(0, 556);
|
||||
panelGPUTemp.Margin = new Padding(4);
|
||||
panelGPUTemp.MaximumSize = new Size(0, 124);
|
||||
panelGPUTemp.Name = "panelGPUTemp";
|
||||
@@ -1154,7 +1197,7 @@ namespace GHelper
|
||||
panelGPUBoost.Controls.Add(labelGPUBoostTitle);
|
||||
panelGPUBoost.Controls.Add(trackGPUBoost);
|
||||
panelGPUBoost.Dock = DockStyle.Top;
|
||||
panelGPUBoost.Location = new Point(0, 308);
|
||||
panelGPUBoost.Location = new Point(0, 432);
|
||||
panelGPUBoost.Margin = new Padding(4);
|
||||
panelGPUBoost.MaximumSize = new Size(0, 124);
|
||||
panelGPUBoost.Name = "panelGPUBoost";
|
||||
@@ -1203,7 +1246,7 @@ namespace GHelper
|
||||
panelGPUMemory.Controls.Add(labelGPUMemoryTitle);
|
||||
panelGPUMemory.Controls.Add(trackGPUMemory);
|
||||
panelGPUMemory.Dock = DockStyle.Top;
|
||||
panelGPUMemory.Location = new Point(0, 184);
|
||||
panelGPUMemory.Location = new Point(0, 308);
|
||||
panelGPUMemory.Margin = new Padding(4);
|
||||
panelGPUMemory.MaximumSize = new Size(0, 124);
|
||||
panelGPUMemory.Name = "panelGPUMemory";
|
||||
@@ -1252,7 +1295,7 @@ namespace GHelper
|
||||
panelGPUCore.Controls.Add(trackGPUCore);
|
||||
panelGPUCore.Controls.Add(labelGPUCoreTitle);
|
||||
panelGPUCore.Dock = DockStyle.Top;
|
||||
panelGPUCore.Location = new Point(0, 60);
|
||||
panelGPUCore.Location = new Point(0, 184);
|
||||
panelGPUCore.Margin = new Padding(4);
|
||||
panelGPUCore.MaximumSize = new Size(0, 124);
|
||||
panelGPUCore.Name = "panelGPUCore";
|
||||
@@ -1416,41 +1459,55 @@ namespace GHelper
|
||||
buttonCPU.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||
buttonCPU.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// panelPowerModeTItle
|
||||
// panelGPUClockLimit
|
||||
//
|
||||
panelPowerModeTItle.AutoSize = true;
|
||||
panelPowerModeTItle.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelPowerModeTItle.Controls.Add(picturePowerMode);
|
||||
panelPowerModeTItle.Controls.Add(labelPowerModeTitle);
|
||||
panelPowerModeTItle.Dock = DockStyle.Top;
|
||||
panelPowerModeTItle.Location = new Point(0, 0);
|
||||
panelPowerModeTItle.Margin = new Padding(4);
|
||||
panelPowerModeTItle.Name = "panelPowerModeTItle";
|
||||
panelPowerModeTItle.Size = new Size(520, 60);
|
||||
panelPowerModeTItle.TabIndex = 50;
|
||||
panelGPUClockLimit.AutoSize = true;
|
||||
panelGPUClockLimit.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||
panelGPUClockLimit.Controls.Add(labelGPUClockLimit);
|
||||
panelGPUClockLimit.Controls.Add(trackGPUClockLimit);
|
||||
panelGPUClockLimit.Controls.Add(labelGPUClockLimitTitle);
|
||||
panelGPUClockLimit.Dock = DockStyle.Top;
|
||||
panelGPUClockLimit.Location = new Point(0, 60);
|
||||
panelGPUClockLimit.Margin = new Padding(4);
|
||||
panelGPUClockLimit.MaximumSize = new Size(0, 124);
|
||||
panelGPUClockLimit.Name = "panelGPUClockLimit";
|
||||
panelGPUClockLimit.Size = new Size(520, 124);
|
||||
panelGPUClockLimit.TabIndex = 48;
|
||||
//
|
||||
// picturePowerMode
|
||||
// labelGPUClockLimit
|
||||
//
|
||||
picturePowerMode.BackgroundImage = Properties.Resources.icons8_gauge_32;
|
||||
picturePowerMode.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
picturePowerMode.InitialImage = null;
|
||||
picturePowerMode.Location = new Point(10, 18);
|
||||
picturePowerMode.Margin = new Padding(4, 2, 4, 10);
|
||||
picturePowerMode.Name = "picturePowerMode";
|
||||
picturePowerMode.Size = new Size(32, 32);
|
||||
picturePowerMode.TabIndex = 40;
|
||||
picturePowerMode.TabStop = false;
|
||||
labelGPUClockLimit.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelGPUClockLimit.Location = new Point(326, 16);
|
||||
labelGPUClockLimit.Margin = new Padding(4, 0, 4, 0);
|
||||
labelGPUClockLimit.Name = "labelGPUClockLimit";
|
||||
labelGPUClockLimit.Size = new Size(176, 32);
|
||||
labelGPUClockLimit.TabIndex = 29;
|
||||
labelGPUClockLimit.Text = "1500 MHz";
|
||||
labelGPUClockLimit.TextAlign = ContentAlignment.TopRight;
|
||||
//
|
||||
// labelPowerModeTitle
|
||||
// trackGPUClockLimit
|
||||
//
|
||||
labelPowerModeTitle.AutoSize = true;
|
||||
labelPowerModeTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||
labelPowerModeTitle.Location = new Point(46, 18);
|
||||
labelPowerModeTitle.Margin = new Padding(4, 0, 4, 0);
|
||||
labelPowerModeTitle.Name = "labelPowerModeTitle";
|
||||
labelPowerModeTitle.Size = new Size(271, 32);
|
||||
labelPowerModeTitle.TabIndex = 39;
|
||||
labelPowerModeTitle.Text = "Windows Power Mode";
|
||||
trackGPUClockLimit.LargeChange = 100;
|
||||
trackGPUClockLimit.Location = new Point(6, 48);
|
||||
trackGPUClockLimit.Margin = new Padding(4, 2, 4, 2);
|
||||
trackGPUClockLimit.Maximum = 3000;
|
||||
trackGPUClockLimit.Name = "trackGPUClockLimit";
|
||||
trackGPUClockLimit.RightToLeft = RightToLeft.No;
|
||||
trackGPUClockLimit.Size = new Size(496, 90);
|
||||
trackGPUClockLimit.SmallChange = 10;
|
||||
trackGPUClockLimit.TabIndex = 18;
|
||||
trackGPUClockLimit.TickFrequency = 50;
|
||||
trackGPUClockLimit.TickStyle = TickStyle.TopLeft;
|
||||
//
|
||||
// labelGPUClockLimitTitle
|
||||
//
|
||||
labelGPUClockLimitTitle.AutoSize = true;
|
||||
labelGPUClockLimitTitle.Location = new Point(10, 16);
|
||||
labelGPUClockLimitTitle.Margin = new Padding(4, 0, 4, 0);
|
||||
labelGPUClockLimitTitle.Name = "labelGPUClockLimitTitle";
|
||||
labelGPUClockLimitTitle.Size = new Size(188, 32);
|
||||
labelGPUClockLimitTitle.TabIndex = 17;
|
||||
labelGPUClockLimitTitle.Text = "Core Clock Limit";
|
||||
//
|
||||
// Fans
|
||||
//
|
||||
@@ -1519,10 +1576,13 @@ namespace GHelper
|
||||
panelTitleCPU.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCPU).EndInit();
|
||||
panelBoost.ResumeLayout(false);
|
||||
panelPowerMode.ResumeLayout(false);
|
||||
panelBoostTitle.ResumeLayout(false);
|
||||
panelBoostTitle.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoost).EndInit();
|
||||
panelPowerMode.ResumeLayout(false);
|
||||
panelPowerModeTItle.ResumeLayout(false);
|
||||
panelPowerModeTItle.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)picturePowerMode).EndInit();
|
||||
panelGPU.ResumeLayout(false);
|
||||
panelGPU.PerformLayout();
|
||||
panelGPUTemp.ResumeLayout(false);
|
||||
@@ -1542,9 +1602,9 @@ namespace GHelper
|
||||
((System.ComponentModel.ISupportInitialize)pictureGPU).EndInit();
|
||||
panelNav.ResumeLayout(false);
|
||||
tableNav.ResumeLayout(false);
|
||||
panelPowerModeTItle.ResumeLayout(false);
|
||||
panelPowerModeTItle.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)picturePowerMode).EndInit();
|
||||
panelGPUClockLimit.ResumeLayout(false);
|
||||
panelGPUClockLimit.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)trackGPUClockLimit).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@@ -1647,5 +1707,9 @@ namespace GHelper
|
||||
private Panel panelPowerModeTItle;
|
||||
private PictureBox picturePowerMode;
|
||||
private Label labelPowerModeTitle;
|
||||
private Panel panelGPUClockLimit;
|
||||
private Label labelGPUClockLimit;
|
||||
private TrackBar trackGPUClockLimit;
|
||||
private Label labelGPUClockLimitTitle;
|
||||
}
|
||||
}
|
||||
31
app/Fans.cs
31
app/Fans.cs
@@ -109,6 +109,9 @@ namespace GHelper
|
||||
checkApplyFans.Click += CheckApplyFans_Click;
|
||||
checkApplyPower.Click += CheckApplyPower_Click;
|
||||
|
||||
trackGPUClockLimit.Minimum = NvidiaGpuControl.MinClockLimit;
|
||||
trackGPUClockLimit.Maximum = NvidiaGpuControl.MaxClockLimit;
|
||||
|
||||
trackGPUCore.Minimum = NvidiaGpuControl.MinCoreOffset;
|
||||
trackGPUCore.Maximum = NvidiaGpuControl.MaxCoreOffset;
|
||||
|
||||
@@ -121,6 +124,7 @@ namespace GHelper
|
||||
trackGPUTemp.Minimum = AsusACPI.MinGPUTemp;
|
||||
trackGPUTemp.Maximum = AsusACPI.MaxGPUTemp;
|
||||
|
||||
trackGPUClockLimit.Scroll += trackGPUClockLimit_Scroll;
|
||||
trackGPUCore.Scroll += trackGPU_Scroll;
|
||||
trackGPUMemory.Scroll += trackGPU_Scroll;
|
||||
|
||||
@@ -131,6 +135,7 @@ namespace GHelper
|
||||
trackGPUMemory.MouseUp += TrackGPU_MouseUp;
|
||||
trackGPUBoost.MouseUp += TrackGPU_MouseUp;
|
||||
trackGPUTemp.MouseUp += TrackGPU_MouseUp;
|
||||
trackGPUClockLimit.MouseUp += TrackGPU_MouseUp;
|
||||
|
||||
//labelInfo.MaximumSize = new Size(280, 0);
|
||||
labelFansResult.Visible = false;
|
||||
@@ -435,14 +440,18 @@ namespace GHelper
|
||||
|
||||
int gpu_boost = AppConfig.GetMode("gpu_boost");
|
||||
int gpu_temp = AppConfig.GetMode("gpu_temp");
|
||||
|
||||
int core = AppConfig.GetMode("gpu_core");
|
||||
int memory = AppConfig.GetMode("gpu_memory");
|
||||
|
||||
int clock_limit = AppConfig.GetMode("gpu_clock_limit");
|
||||
|
||||
if (gpu_boost < 0) gpu_boost = AsusACPI.MaxGPUBoost;
|
||||
if (gpu_temp < 0) gpu_temp = AsusACPI.MaxGPUTemp;
|
||||
|
||||
if (core == -1) core = 0;
|
||||
if (memory == -1) memory = 0;
|
||||
if (clock_limit == -1) clock_limit = NvidiaGpuControl.MaxClockLimit;
|
||||
|
||||
//if (readClocks)
|
||||
//{
|
||||
@@ -463,6 +472,7 @@ namespace GHelper
|
||||
}
|
||||
|
||||
//}
|
||||
trackGPUClockLimit.Value = Math.Max(Math.Min(clock_limit, NvidiaGpuControl.MaxClockLimit), NvidiaGpuControl.MinClockLimit);
|
||||
|
||||
trackGPUCore.Value = Math.Max(Math.Min(core, NvidiaGpuControl.MaxCoreOffset), NvidiaGpuControl.MinCoreOffset);
|
||||
trackGPUMemory.Value = Math.Max(Math.Min(memory, NvidiaGpuControl.MaxMemoryOffset), NvidiaGpuControl.MinMemoryOffset);
|
||||
@@ -488,8 +498,24 @@ namespace GHelper
|
||||
{
|
||||
labelGPUCore.Text = $"{trackGPUCore.Value} MHz";
|
||||
labelGPUMemory.Text = $"{trackGPUMemory.Value} MHz";
|
||||
|
||||
labelGPUBoost.Text = $"{trackGPUBoost.Value}W";
|
||||
labelGPUTemp.Text = $"{trackGPUTemp.Value}°C";
|
||||
|
||||
if (trackGPUClockLimit.Value >= NvidiaGpuControl.MaxClockLimit)
|
||||
labelGPUClockLimit.Text = "Default";
|
||||
else
|
||||
labelGPUClockLimit.Text = $"{trackGPUClockLimit.Value} MHz";
|
||||
}
|
||||
|
||||
private void trackGPUClockLimit_Scroll(object? sender, EventArgs e)
|
||||
{
|
||||
|
||||
int maxClock = (int)Math.Round((float)trackGPUClockLimit.Value / 50) * 50;
|
||||
|
||||
trackGPUClockLimit.Value = maxClock;
|
||||
AppConfig.SetMode("gpu_clock_limit", maxClock);
|
||||
VisualiseGPUSettings();
|
||||
}
|
||||
|
||||
private void trackGPU_Scroll(object? sender, EventArgs e)
|
||||
@@ -501,6 +527,7 @@ namespace GHelper
|
||||
AppConfig.SetMode("gpu_core", trackGPUCore.Value);
|
||||
AppConfig.SetMode("gpu_memory", trackGPUMemory.Value);
|
||||
|
||||
|
||||
VisualiseGPUSettings();
|
||||
|
||||
}
|
||||
@@ -897,13 +924,17 @@ namespace GHelper
|
||||
|
||||
if (gpuVisible)
|
||||
{
|
||||
trackGPUClockLimit.Value = NvidiaGpuControl.MaxClockLimit;
|
||||
trackGPUCore.Value = 0;
|
||||
trackGPUMemory.Value = 0;
|
||||
trackGPUBoost.Value = AsusACPI.MaxGPUBoost;
|
||||
trackGPUTemp.Value = AsusACPI.MaxGPUTemp;
|
||||
|
||||
AppConfig.SetMode("gpu_clock_limit", trackGPUClockLimit.Value);
|
||||
|
||||
AppConfig.SetMode("gpu_boost", trackGPUBoost.Value);
|
||||
AppConfig.SetMode("gpu_temp", trackGPUTemp.Value);
|
||||
|
||||
AppConfig.SetMode("gpu_core", trackGPUCore.Value);
|
||||
AppConfig.SetMode("gpu_memory", trackGPUMemory.Value);
|
||||
|
||||
|
||||
@@ -18,8 +18,12 @@ public class NvidiaGpuControl : IGpuControl
|
||||
public const int MinCoreOffset = -250;
|
||||
public const int MinMemoryOffset = -250;
|
||||
|
||||
public const int MinClockLimit = 1000;
|
||||
public const int MaxClockLimit = 3000;
|
||||
|
||||
private static PhysicalGPU? _internalGpu;
|
||||
|
||||
private static int _maxClock = -1;
|
||||
public NvidiaGpuControl()
|
||||
{
|
||||
_internalGpu = GetInternalDiscreteGpu();
|
||||
@@ -108,15 +112,11 @@ public class NvidiaGpuControl : IGpuControl
|
||||
}
|
||||
|
||||
|
||||
public bool RestartGPU()
|
||||
private bool RunPowershellCommand(string script)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
string script = @"$device = Get-PnpDevice | Where-Object { $_.FriendlyName -imatch 'NVIDIA' -and $_.Class -eq 'Display' }; Disable-PnpDevice $device.InstanceId -Confirm:$false; Start-Sleep -Seconds 5; Enable-PnpDevice $device.InstanceId -Confirm:$false";
|
||||
Logger.WriteLine(script);
|
||||
ProcessHelper.RunCMD("powershell", script);
|
||||
//Thread.Sleep(2000);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -124,6 +124,30 @@ public class NvidiaGpuControl : IGpuControl
|
||||
Logger.WriteLine(ex.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool SetMaxGPUClock (int clock)
|
||||
{
|
||||
int oldClock = _maxClock;
|
||||
|
||||
if (clock >= MinClockLimit && clock < MaxClockLimit)
|
||||
RunPowershellCommand($"nvidia-smi -lgc 0,{clock}");
|
||||
else
|
||||
{
|
||||
clock = -1;
|
||||
RunPowershellCommand($"nvidia-smi -rgc");
|
||||
}
|
||||
|
||||
_maxClock = clock;
|
||||
|
||||
return (oldClock != clock);
|
||||
|
||||
}
|
||||
|
||||
public bool RestartGPU()
|
||||
{
|
||||
return RunPowershellCommand(@"$device = Get-PnpDevice | Where-Object { $_.FriendlyName -imatch 'NVIDIA' -and $_.Class -eq 'Display' }; Disable-PnpDevice $device.InstanceId -Confirm:$false; Start-Sleep -Seconds 5; Enable-PnpDevice $device.InstanceId -Confirm:$false");
|
||||
}
|
||||
|
||||
public int SetClocksFromConfig()
|
||||
|
||||
@@ -132,7 +132,12 @@ namespace GHelper.Helpers
|
||||
cmd.StartInfo.FileName = name;
|
||||
cmd.StartInfo.Arguments = args;
|
||||
cmd.Start();
|
||||
Logger.WriteLine(cmd.StandardOutput.ReadToEnd());
|
||||
|
||||
string result = cmd.StandardOutput.ReadToEnd().Replace(Environment.NewLine, " ").Trim(' ');
|
||||
|
||||
Logger.WriteLine(args);
|
||||
Logger.WriteLine(result);
|
||||
|
||||
cmd.WaitForExit();
|
||||
}
|
||||
|
||||
|
||||
@@ -293,6 +293,7 @@ namespace GHelper.Mode
|
||||
|
||||
int gpu_core = AppConfig.GetMode("gpu_core");
|
||||
int gpu_memory = AppConfig.GetMode("gpu_memory");
|
||||
int gpu_clock_limit = AppConfig.GetMode("gpu_clock_limit");
|
||||
|
||||
if (gpu_core == -1 && gpu_memory == -1) return;
|
||||
|
||||
@@ -305,6 +306,11 @@ namespace GHelper.Mode
|
||||
using NvidiaGpuControl nvControl = (NvidiaGpuControl)HardwareControl.GpuControl;
|
||||
try
|
||||
{
|
||||
|
||||
bool changed = nvControl.SetMaxGPUClock(gpu_clock_limit);
|
||||
if (changed && launchAsAdmin) ProcessHelper.RunAsAdmin("gpu");
|
||||
|
||||
|
||||
int getStatus = nvControl.GetClocks(out int current_core, out int current_memory);
|
||||
if (getStatus != -1)
|
||||
{
|
||||
@@ -312,7 +318,8 @@ namespace GHelper.Mode
|
||||
}
|
||||
|
||||
int setStatus = nvControl.SetClocks(gpu_core, gpu_memory);
|
||||
if (launchAsAdmin && setStatus == -1) ProcessHelper.RunAsAdmin("gpu");
|
||||
if (launchAsAdmin) ProcessHelper.RunAsAdmin("gpu");
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user