You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running a software that keeps track of CPU temperature over time using psutil.
The platform is a miniPC using Intel CPU N100.
I noticed that for most of the time the temperature readings are consistent over the 24hours. However almost every day there is a period that lasts 1-2 hours where the CPU temperatures show sudden temporary spikes from a value of about 35 celsius degrees up to 50-55 celsius degrees. Such spikes last less than 1sec.
More in details: I've been using the example code from here: https://github.com/giampaolo/psutil/blob/master/scripts/temperatures.py
with small modifications, just to print the timestamp, then print temp sample, sleep 1 sec and repeat.
Here's an example of a temperature spike:
20240515_20:41:59
acpitz
acpitz 27.8 °C (high = 110.0 °C, critical = 110.0 °C)
coretemp
Package id 0 37.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 0 32.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 1 32.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 2 32.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 3 32.0 °C (high = 105.0 °C, critical = 105.0 °C)
20240515_20:42:00
acpitz
acpitz 27.8 °C (high = 110.0 °C, critical = 110.0 °C)
coretemp
Package id 0 54.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 0 54.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 1 54.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 2 54.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 3 32.0 °C (high = 105.0 °C, critical = 105.0 °C)
20240515_20:42:01
acpitz
acpitz 27.8 °C (high = 110.0 °C, critical = 110.0 °C)
coretemp
Package id 0 37.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 0 32.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 1 32.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 2 32.0 °C (high = 105.0 °C, critical = 105.0 °C)
Core 3 32.0 °C (high = 105.0 °C, critical = 105.0 °C)
As can be seen the 2nd sample, at the time 20:42:00 shows Package temp and Cores 0-3 temp up to 54 degrees while 1sec before the temp was 32degrees and 1sec later it's again 32degrees.
There is no particular load on the CPU at the time of the measurement.
It's hard to believe that a transient of +22 degrees can happen in <1sec.
Is perhaps the problem coming from the kernel module that provides temperature data?
How I do find out where is the source of temperature information used by psutil?
Here's an 'lsmod' that shows some (maybe useful) info:
Thanks @giampaolo for very fast answer.
I have been running 'watch -n1 sensors' just now and indeed I see some "crazy" sample appearing every now and then.
I guess that sounds like a kernel(module) bug?
Would it make sense to build some 'moving average' filtering on psutil side to handle such buggy sensors?
Nope. We should always return what the kernel gives us.
To be honest, there is one exception in psutil: net_io_counters() and disk_io_counters(). On long running systems the kernel may wrap the returned numbers and restart from 0, in which case psutil will adjust them so they never go backwards:
Summary
Description
I'm running a software that keeps track of CPU temperature over time using psutil.
The platform is a miniPC using Intel CPU N100.
I noticed that for most of the time the temperature readings are consistent over the 24hours. However almost every day there is a period that lasts 1-2 hours where the CPU temperatures show sudden temporary spikes from a value of about 35 celsius degrees up to 50-55 celsius degrees. Such spikes last less than 1sec.
More in details: I've been using the example code from here: https://github.com/giampaolo/psutil/blob/master/scripts/temperatures.py
with small modifications, just to print the timestamp, then print temp sample, sleep 1 sec and repeat.
Here's an example of a temperature spike:
As can be seen the 2nd sample, at the time 20:42:00 shows Package temp and Cores 0-3 temp up to 54 degrees while 1sec before the temp was 32degrees and 1sec later it's again 32degrees.
There is no particular load on the CPU at the time of the measurement.
It's hard to believe that a transient of +22 degrees can happen in <1sec.
Is perhaps the problem coming from the kernel module that provides temperature data?
How I do find out where is the source of temperature information used by psutil?
Here's an 'lsmod' that shows some (maybe useful) info:
Thanks
The text was updated successfully, but these errors were encountered: