根據該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