Processors
Processors (Intel® Core™, Intel® Xeon®, etc); processor utilities and programs (Intel® Processor Identification Utility, Intel® Extreme Tuning Utility, Intel® Easy Streaming Wizard, etc.)
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
11684 Discussions

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

gomi
Beginner
306 Views

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
1 Solution
n_scott_pearson
Super User Retired Employee
287 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
n_scott_pearson
Super User Retired Employee
288 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

gomi
Beginner
280 Views
I have to do this on kernel mode right ? For c++ Windows has ntddk.h for it.
Reply