12

I want to use i3status to display my CPU-Core temperatures (haswell i7). However the setting:

order += "cpu_temperature 1"
#...
cpu_temperature 1{
        format = "T: %degree °C"
}
#

doesn't display the correct core temperature. The numbers it shows seem to correspond to the value xsensors shows for temp1, if I change the 1 to 2 above it corresponds to xsensors temp2. Trying 3 or 4 doesn't have any effect. However I want to get the true core temperatures of all 4 cores with i3 status. How can I do this?

17

i3status

Using i3status I believe you can change your configuration slightly so that it gets the CPU's core temperature directly from /sys by providing a path to its value. So change your rule to something like this:

order += "cpu_temperature 1"
# and more if you like...
# order += "cpu_temperature 2"

#...   
cpu_temperature 1 {
        format = "T: %degrees °C"
        path = "/sys/devices/platform/coretemp.0/temp1_input"
}

# cpu_temperature 2 {
#        format = "T: %degrees °C"
#        path = "/sys/devices/platform/coretemp.0/temp2_input"
# }

Here are 4 other ways to get your temp:

/proc

$ cat /proc/acpi/thermal_zone/THM0/temperature
temperature:             72 C

acpi

$ acpi -t
Thermal 0: ok, 64.0 degrees C

From the acpi man page:

   -t |  --thermal
             show thermal information

/sys

$ cat /sys/bus/acpi/devices/LNXTHERM\:01/thermal_zone/temp 
70000

lm_sensors

If you install the lmsensors package like so:

Fedora/CentOS/RHEL:

$ sudo yum install lm_sensors

Debian/Ubuntu:

$ sudo apt-get install lm-sensors

Detect your hardware:

$ sudo sensors-detect

You can also install the modules manually, for example:

$ sudo modprobe coretemp
$ modprobe i2c-i801

NOTE: The sensor-detect should detect your specific hardware, so you might need to modprobe <my driver> instead for the 2nd command above.

On my system I have the following i2c modules loaded:

$ lsmod | grep i2c
i2c_i801               11088  0 
i2c_algo_bit            5205  1 i915
i2c_core               27212  5 i2c_i801,i915,drm_kms_helper,drm,i2c_algo_bit

Now run the sensors app to query the resulting temperatures:

$ sudo sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +68.0°C  (crit = +100.0°C)

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        3831 RPM
temp1:        +68.0°C  
temp2:         +0.0°C  
temp3:         +0.0°C  
temp4:         +0.0°C  
temp5:         +0.0°C  
temp6:         +0.0°C  
temp7:         +0.0°C  
temp8:         +0.0°C  

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +56.0°C  (high = +95.0°C, crit = +105.0°C)

coretemp-isa-0002
Adapter: ISA adapter
Core 2:       +57.0°C  (high = +95.0°C, crit = +105.0°C)

This is on my Thinkpad T410 which has i5 M560. Here's one of the cores:

$ cat /proc/cpuinfo 
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 37
model name  : Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz
stepping    : 5
cpu MHz     : 1199.000
cache size  : 3072 KB
physical id : 0
siblings    : 4
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 11
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat tpr_shadow vnmi flexpriority ept vpid
bogomips    : 5319.22
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:
  • /proc/acpi/thermal_zone doesn't exist in my case (ubuntu 13.04) – student Aug 13 '13 at 10:10
  • @student - OK I see that you're asking for how to do it with i3status specifically, never heard of that tool, give me a sec to figure it out using that tool. – slm Aug 13 '13 at 13:01
  • @student - see updates. – slm Aug 13 '13 at 13:12
  • Thanks, this works. With temp2_input one gets the temperature of the second core and so on... – student Aug 13 '13 at 20:16
  • @student - SWEET! BTW, thanks for fixing my typo! – slm Aug 13 '13 at 20:16
0

In my case I had to read the value from:

/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input

My i3status config:

cpu_temperature 0 {
              format = "T: %degrees °C"
              path = "/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input"
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.