我需要为正在开发的应用程序收集一些系统信息。使用C#可以轻松获得可用内存和CPU负载。不幸的是,CPU温度并不是那么容易。我尝试使用WMI,但无法使用任何东西Win32_TemperatureProbe要么MSAcpi_ThermalZoneTemperature有没有人处理过这个问题?我想知道像SiSoftware Sandra这样的监视程序如何获得该信息...以防万一有人感兴趣,下面是该类的代码:public class SystemInformation{ private System.Diagnostics.PerformanceCounter m_memoryCounter; private System.Diagnostics.PerformanceCounter m_CPUCounter; public SystemInformation() { m_memoryCounter = new System.Diagnostics.PerformanceCounter(); m_memoryCounter.CategoryName = "Memory"; m_memoryCounter.CounterName = "Available MBytes"; m_CPUCounter = new System.Diagnostics.PerformanceCounter(); m_CPUCounter.CategoryName = "Processor"; m_CPUCounter.CounterName = "% Processor Time"; m_CPUCounter.InstanceName = "_Total"; } public float GetAvailableMemory() { return m_memoryCounter.NextValue(); } public float GetCPULoad() { return m_CPUCounter.NextValue(); } public float GetCPUTemperature() { //... return 0; }}
3 回答
- 3 回答
- 0 关注
- 561 浏览
添加回答
举报
0/150
提交
取消