c# - How do I get the NVIDIA core temperature in an integer value? -
i taking arduino microcontroller class , i'm working on final project: automated computer cooling system works according case temperature.
i unable nvidia gpu core temp using following sources: this msdn link or this nvidia link. how can value of temperature of gpu?
my knowledge in c# basic , couldn't make heads tails on manual or code examples in msdn.
i'm gonna go ahead , answer own question after long time of searching how found way data.
using openhardwaremonitor.dll open source links able needed.
this code used in windows c# application (it might not best way gets job done.
hope finds helpful:
using openhardwaremonitor.hardware;
. . .
public partial class mainwindow : form { computer mycomputer; public mainwindow() { initializecomponent(); mycomputer = new computer(); mycomputer.open(); mycomputer.gpuenabled = true; mycomputer.cpuenabled = true; foreach (var hardwareitem in mycomputer.hardware) { if (hardwareitem.hardwaretype == hardwaretype.gpunvidia) { foreach (var sensor in hardwareitem.sensors) { if (sensor.sensortype == sensortype.temperature) { gputemp.text = string.format(sensor.value + "°c"); } } } if (hardwareitem.hardwaretype == hardwaretype.cpu) { foreach (var sensor in hardwareitem.sensors) { if (sensor.sensortype == sensortype.temperature) { cputemp.text = string.format(sensor.value + "°c"); } } } } } private void valuerefresh_tick(object sender, eventargs e) { mycomputer = new computer(); mycomputer.open(); mycomputer.gpuenabled = true; mycomputer.cpuenabled = true; foreach (var hardwareitem in mycomputer.hardware) { if (hardwareitem.hardwaretype == hardwaretype.gpunvidia) { foreach (var sensor in hardwareitem.sensors) { if (sensor.sensortype == sensortype.temperature) { gputemp.text = string.format(sensor.value.tostring()); // write value lable on form } } } if (hardwareitem.hardwaretype == hardwaretype.cpu) { foreach (var sensor in hardwareitem.sensors) { if (sensor.sensortype == sensortype.temperature) { cputemp.text = string.format(sensor.value.tostring()); // write value lable on form } } } } } }
Comments
Post a Comment