Skip to content

Conversation

@ffeldbauer
Copy link

Added support to monitor the CPU temperature on Linux. New function uses the LOAD_TYPE scan rate like all the other CPU related informations.

Added support to monitor the CPU temperature on Linux.
New function uses the LOAD_TYPE scan rate like all the
other CPU related informations.
@ffeldbauer
Copy link
Author

ffeldbauer commented Sep 25, 2023

Sorry for not responding so long regarding my merge request #45
I was busy preparing our Detector setup for a beamtime and was not able to look into the issue regarding the broken CI.

When I tried to merge the latest master into my fork, I ran into a few new issues, which is why I started from a fresh clone of the current master and added my changes to it

@JJL772
Copy link

JJL772 commented Dec 2, 2023

/sys/class/thermal/thermal_zone0 on my system corresponds to ACPI interface temperature. you might need to iterate each thermal_zone and check the type file in each of them.
for me, thermal_zone4 had type x86_pkg_temp, which seems to match up with the CPU package temperature displayed by lm-sensors.

@jeonghanlee
Copy link
Contributor

@ffeldbauer Thank you for bring this subject again. And please check the previous discussion at #7 with @ralphlange

You may find his insights on this pull request.

@JJL772
Copy link

JJL772 commented Mar 9, 2025

@ffeldbauer I think the best way to implement this would be using the hwmon stuff in sysfs. On my desktop (AMD 7950X) I don't have a thermal zone that corresponds to CPU temperature, only one for acpi.

The hwmon drivers 'coretemp' and 'k10temp' seem to be reliably available on x86 platforms. You can see which your system has by running cat /sys/class/hwmon/hwmon*/name. On raspberry pi there is 'cpu_thermal' instead, which behaves much the same.

See the Linux docs on coretemp (for Intel x86 processors) and k10temp (for AMD x86 processors)

These drivers can report more than one temperature. For k10temp, the Tctl field is what you want to monitor. For coretemp, it's Package id .... You can list the fields by doing cat /sys/class/hwmon/hwmon*/temp*_label.
On raspberry pi, I find that 'cpu_thermal' only has one input: temp1_input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants