private NvGpuThermalSettings ObtainThermalSettings() { var settings = new NvGpuThermalSettings { Version = NvApi.GpuThermalSettingsVer, Count = NvApi.MaxThermalSensorsPerGpu }; settings.Sensor = new NvSensor[settings.Count]; if (NvApi.GetThermalSettings(Gpu.AdapterHandle, (int)NvThermalTarget.All, ref settings) != NvStatus.Ok) { settings.Count = 0; } return(settings); }
/// <summary> /// Gets the tempature of the graphics card. /// </summary> /// <returns></returns> public LuaResult GetGpuTemps() { switch (DebugSettings.GpuVendor) { case GpuVendor.Nvidia: NvApi.ThermalSettings thermalSettings = new NvApi.ThermalSettings(); if (NvApi.GetThermalSettings(Renderer.Device.NativePointer, 0, ref thermalSettings) != 0) { throw new Exception("NvidiaControlPanel.GetThermalSettings() returned false."); } var sensor = thermalSettings.Sensors[0]; return(new LuaResult(sensor.CurrentTemp, sensor.DefaultMinTemp, sensor.DefaultMaxTemp)); case GpuVendor.AMD: throw new NotImplementedException(); case GpuVendor.Intel: throw new NotImplementedException(); default: throw new NotSupportedException($"Tempature measurements are not supported for vendor {DebugSettings.GpuVendor}"); } }