我需要為正在開發(fā)的應(yīng)用程序收集一些系統(tǒng)信息。使用C??梢暂p松獲得可用內(nèi)存和CPU負載。不幸的是,CPU溫度并不是那么容易。我嘗試使用WMI,但無法使用任何東西Win32_TemperatureProbe要么MSAcpi_ThermalZoneTemperature有沒有人處理過這個問題?我想知道像SiSoftware Sandra這樣的監(jiān)視程序如何獲得該信息...以防萬一有人感興趣,下面是該類的代碼: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 回答
- 0 關(guān)注
- 584 瀏覽
添加回答
舉報
0/150
提交
取消