MSAcpi_ThermalZoneTemperature类未显示实际温度

我想实时获取CPU性能数据,包括温度。 我使用以下代码来获取CPU温度:

try { ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature"); foreach (ManagementObject queryObj in searcher.Get()) { double temp = Convert.ToDouble(queryObj["CurrentTemperature"].ToString()); double temp_critical = Convert.ToDouble(queryObj["CriticalTripPoint"].ToString()); double temp_cel = (temp/10 - 273.15); double temp_critical_cel = temp_critical / 10 - 273.15; lblCurrentTemp.Text = temp_cel.ToString(); lblCriticalTemp.Text = temp_critical_cel.ToString(); } } catch (ManagementException e) { MessageBox.Show("An error occurred while querying for WMI data: " + e.Message); } 

但此代码显示的温度不是正确的温度。 它通常显示49.5-50.5摄氏度。 但我使用“OpenHardwareMonitor”报告CPU温度超过71摄氏度并随时间分数改变分数。 我在代码中缺少什么?

我在timer_click事件中使用了上面的代码,每500ms间隔刷新一次温度读数,但是从执行开始它总是显示相同的温度。 这意味着如果你运行这个应用程序,如果它显示49度,那么在1小时的会话后,它将不断显示49度。 问题出在哪儿?

在http://www.scriptinternals.com/new/us/support/Internal/WMI_MSAcpi_ThermalZoneTemperature.htm中,我发现CurrentTemperature在主板上的某个热区返回温度。 这意味着它不会返回CPU温度。 这与厨房的温度是30C相同,但炉子是200C左右……这种方式无法显示CPU的准确温度。 要获得编写内核驱动程序所需的CPU(以及每个内核)的准确温度,更复杂的是。

总而言之,您的代码应该做到这一点,因为您需要以其他方式使用温度。