mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Overclocking logic, added restart-gpu workaround
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using NvAPIWrapper.GPU;
|
||||
using NvAPIWrapper.Native;
|
||||
using NvAPIWrapper.Native.Delegates;
|
||||
using NvAPIWrapper.Native.GPU;
|
||||
using NvAPIWrapper.Native.GPU.Structures;
|
||||
using NvAPIWrapper.Native.Interfaces.GPU;
|
||||
@@ -74,6 +75,41 @@ public class NvidiaGpuControl : IGpuControl
|
||||
|
||||
}
|
||||
|
||||
private static void RunCMD(string name, string args)
|
||||
{
|
||||
var cmd = new Process();
|
||||
cmd.StartInfo.UseShellExecute = false;
|
||||
cmd.StartInfo.CreateNoWindow = true;
|
||||
cmd.StartInfo.RedirectStandardOutput = true;
|
||||
cmd.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
cmd.StartInfo.FileName = name;
|
||||
cmd.StartInfo.Arguments = args;
|
||||
cmd.Start();
|
||||
Logger.WriteLine(cmd.StandardOutput.ReadToEnd());
|
||||
cmd.WaitForExit();
|
||||
}
|
||||
|
||||
|
||||
public void RestartGPU()
|
||||
{
|
||||
|
||||
if (!IsValid) return;
|
||||
|
||||
try
|
||||
{
|
||||
PhysicalGPU internalGpu = _internalGpu!;
|
||||
var pnpDeviceId = internalGpu.BusInformation.PCIIdentifiers.ToString();
|
||||
Logger.WriteLine("Device ID:"+ pnpDeviceId);
|
||||
RunCMD("pnputil", $"/disable-device /deviceid \"{pnpDeviceId}\"");
|
||||
Thread.Sleep(1000);
|
||||
RunCMD("pnputil", $"/enable-device /deviceid \"{pnpDeviceId}\"");
|
||||
}
|
||||
catch (Exception ex )
|
||||
{
|
||||
Logger.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public int SetClocksFromConfig()
|
||||
{
|
||||
int core = Program.config.getConfig("gpu_core");
|
||||
|
||||
Reference in New Issue
Block a user