Ubuntu – discrepancy between number of cores and thermal zones in `/sys/class/thermal/`

temperatureUbuntu

I have an Ubuntu 14.04 system with 8 cores:

$ cat /proc/cpuinfo | grep ^processor | wc -l
8

Yet, I see 11 thermal zones under /sys/classes/thermal:

ls /sys/class/thermal/thermal_zone* | wc -l
11

The thermal zones are named thermal_zone0 to thermal_zone10.

Why this discrepancy and is there a way to obtain a single temperature metric (e.g. temperature of hottest core)? I need a single metric as I want to display it on the i3wm status bar. Displaying 11 temperatures would be cumbersome plus I am not sure how these correspond to the 8 cores.

update

The types of the eleven (11) thermal zones are reported as follows:

$ cat /sys/class/thermal/thermal_zone0/type 
acpitz
$ cat /sys/class/thermal/thermal_zone1/type 
acpitz
$ cat /sys/class/thermal/thermal_zone2/type 
INT3400 Thermal
$ cat /sys/class/thermal/thermal_zone3/type 
TMEM
$ cat /sys/class/thermal/thermal_zone4/type 
TAMB
$ cat /sys/class/thermal/thermal_zone5/type 
TAM2
$ cat /sys/class/thermal/thermal_zone5/type 
TAM2
$ cat /sys/class/thermal/thermal_zone6/type 
TNGF
$ cat /sys/class/thermal/thermal_zone7/type 
TEFN
$ cat /sys/class/thermal/thermal_zone8/type 
TSKN
$ cat /sys/class/thermal/thermal_zone9/type 
T_VR
$ cat /sys/class/thermal/thermal_zone10/type 
x86_pkg_temp

This is confusing rather than elucidating as I now can't tell which thermal zones correspond to the 8 CPU cores.

Best Answer

I can confirm Gilles' comment: the CPU temperature (the hottest core) is given by x86_pkg_temp.

So if

$ cat /sys/class/thermal/thermal_zone10/type 
x86_pkg_temp

then /sys/class/thermal/thermal_zone10/temp is the file that should be used in your i3 status bar.

As a side note, the temperature of each core can be read in temp*_input files in /sys/devices/platform/coretemp.0/hwmon/hwmon*/. The associated temp*_label shows which file is related to which core (4 cores in my case):

.../hwmon*/$  grep "" temp*_label
temp1_label:Physical id 0
temp2_label:Core 0
temp3_label:Core 1
temp4_label:Core 2
temp5_label:Core 3

The file temp1_input corresponds to the hottest value of the cores.

Related Question