根据该sysfs documentation,传感器信息被存储/sys/class/hwmon
下具有不同的目录的每个芯片。这与我在Ubuntu 13.10上看到的输出一致。
由传感器所使用的文件是:
/sys/class/hwmon/hwmon*/device/temp*
根据数芯片/虚拟设备上,可以有很多hwmon
目录。
输出我的双核系统中:
$ pwd
/sys/class/hwmon
$ ls -l
total 0
lrwxrwxrwx 1 root root 0 May 17 14:29 hwmon0 -> ../../devices/virtual/hwmon/hwmon0
lrwxrwxrwx 1 root root 0 May 17 14:29 hwmon1 -> ../../devices/platform/coretemp.0/hwmon/hwmon1
lrwxrwxrwx 1 root root 0 May 17 14:29 hwmon2 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon2
凡hwmon1
是一个针对我的CPU:
$ pwd
/sys/class/hwmon/hwmon1/device
$ ls -l
total 0
lrwxrwxrwx 1 root root 0 May 17 14:29 driver -> ../../../bus/platform/drivers/coretemp
drwxr-xr-x 3 root root 0 May 17 14:29 hwmon
-r--r--r-- 1 root root 4096 May 17 23:21 modalias
-r--r--r-- 1 root root 4096 May 17 14:29 name
drwxr-xr-x 2 root root 0 May 17 23:21 power
lrwxrwxrwx 1 root root 0 May 17 14:29 subsystem -> ../../../bus/platform
-r--r--r-- 1 root root 4096 May 17 14:29 temp2_crit
-r--r--r-- 1 root root 4096 May 17 14:29 temp2_crit_alarm
-r--r--r-- 1 root root 4096 May 17 14:29 temp2_input
-r--r--r-- 1 root root 4096 May 17 23:11 temp2_label
-r--r--r-- 1 root root 4096 May 17 14:29 temp2_max
-r--r--r-- 1 root root 4096 May 17 14:29 temp3_crit
-r--r--r-- 1 root root 4096 May 17 14:29 temp3_crit_alarm
-r--r--r-- 1 root root 4096 May 17 14:29 temp3_input
-r--r--r-- 1 root root 4096 May 17 23:11 temp3_label
-r--r--r-- 1 root root 4096 May 17 14:29 temp3_max
-rw-r--r-- 1 root root 4096 May 17 14:29 uevent
temp2*
从这些值和temp3*
分别对应于core 0
和core 1
。基本上这些是从sensors
读取数据的文件。根据你的硬件设备,你的CPU目录(在我的情况下为hwmon1
)与温度信息可能会有所不同。
'strace -f/usr/bin/sensors 2>&1 | grep open'来查看'sensors'打开了什么,可能会给你一个线索。 – nos