我如何获得一个整数值,NVIDIA的核心温度? [英] How do I get the NVIDIA core temperature in an integer value?
问题描述
我正在Arduino的微控制器类和我的工作我的最后一个项目:一个自动化计算机散热系统,根据温度情况下工作。
I am taking a Arduino microcontroller class and I'm working on my final project: an automated computer cooling system that works according to case temperature.
我无法用下面的来源,让我的NVIDIA GPU核心温度:<一href=\"http://social.msdn.microsoft.com/Forums/en-US/c6144f96-dece-4f81-b177-66190b93cbaa/get-nvidia-gpu-temperatures-programmatically\"相对=nofollow>这个MSDN链接或<一个href=\"http://developer.download.nvidia.com/SDK/9.5/Samples/DEMOS/common/src/NvCpl/docs/NVControlPanel_API.pdf\"相对=nofollow>此NVIDIA链接。我怎样才能让我的GPU的温度值?
I was unable to get my NVIDIA GPU core temp using the following sources: this MSDN link or this NVIDIA link. How can I get the value of the temperature of my GPU?
我在C#中的知识是基本的,我不能从MSDN中的手动或code例子尾巴做头。
My knowledge in C# is basic and i couldn't make heads from tails on that manual or code examples in MSDN.
推荐答案
我要继续前进,寻找该怎么做,我发现一种方式来获得数据的很长一段时间后,回答我的问题。
I'm gonna go ahead and answer my own question after a long time of searching how to do that i found a way to get the data.
从使用他们的开源环节OpenHardwareMonitor.dll我能得到我需要的东西。
Using the OpenHardwareMonitor.dll from their open source links i was able to get what i needed.
这是code I在Windows C#应用程序使用(它可能不是做最好的方式,但它能够完成任务。
This is the code i used in a windows c# application (it might not be the best way to do it but it gets the job done.
希望有人认为这很有帮助:
Hope someone finds this 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 the value to a lable on the 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 the value to a lable on the form
}
}
}
}
}
}
这篇关于我如何获得一个整数值,NVIDIA的核心温度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!