Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
157 Views

Is it possible to read temperature information of my 8th gen i7 8700k processor with C++ ?

Jump to solution

Hello,

I Have a Directx11 program which use GPU to draw window and its content. That use winsock2 api to send data on network. My problem is I want to send also processor information on network to see if there is a machine which has temperature problem. Now forget this part, I need to learn if there is a proper way to read this data for this model and how(8th gen i7 8700k). Then, I may try it on a simple command line program with C++.

NOTE: I tried to access a specific register.However, I think results were wrong.

Thank you.

0 Kudos

Accepted Solutions
Highlighted
Super User Retired Employee
138 Views

The only guaranteed way to get processor temperatures is via Model-Specific Register (MSR). All other methods (WMI, ACPI) cannot be guaranteed because they are BIOS- and board/system vendor-specific. 

The processor package temperature, if supported, is available via a MSR. The per-Core temperature sensors are also available via a MSR, but the requesting thread needs to be running on a particular core in order to read that core's temperature.

The problem is that MSRs cannot be read in Ring 3. Ring 0 code (i.e. a device driver) is necessary. If you do not want to implement your own device driver, there are examples around that you may be able to get and use, perhaps even in binary form. For example, I believe that the Open Hardware Monitor project has one. The other alternative is to load a tool that includes its own driver and rely upon interfaces offered by this tool. For example, the CoreTemp facility has an API for accessing its sensor data. The Open Hardware Monitor project also exposes all detected sensors into WMI and also provides a DLL for accessing the readings.

Hope this helps,

...S

View solution in original post

2 Replies
Highlighted
Super User Retired Employee
139 Views

The only guaranteed way to get processor temperatures is via Model-Specific Register (MSR). All other methods (WMI, ACPI) cannot be guaranteed because they are BIOS- and board/system vendor-specific. 

The processor package temperature, if supported, is available via a MSR. The per-Core temperature sensors are also available via a MSR, but the requesting thread needs to be running on a particular core in order to read that core's temperature.

The problem is that MSRs cannot be read in Ring 3. Ring 0 code (i.e. a device driver) is necessary. If you do not want to implement your own device driver, there are examples around that you may be able to get and use, perhaps even in binary form. For example, I believe that the Open Hardware Monitor project has one. The other alternative is to load a tool that includes its own driver and rely upon interfaces offered by this tool. For example, the CoreTemp facility has an API for accessing its sensor data. The Open Hardware Monitor project also exposes all detected sensors into WMI and also provides a DLL for accessing the readings.

Hope this helps,

...S

View solution in original post

Highlighted
Beginner
131 Views
I have to do this on kernel mode right ? For c++ Windows has ntddk.h for it.
0 Kudos