该答案是一种通过直接访问机器特定寄存器(MSR)手动监视某些Intel处理器温度的方法。
首先要注意的是,在这种情况下,从MSR中读取的是相对于极限温度Tcc的,因此需要额外的计算才能确定实际温度。
请参阅《英特尔®64和IA-32架构软件开发人员手册》,或者您所用的AMD等效手册。
就我而言,我希望将MSR的第22-16位设置为0x1B1,又称为IA32_PACKAGE_THERM_STATUS。我的旧i7-2600K的Tcc为98度。
这是一个简单的脚本,用于手动监视温度(和CPU频率):
#! /bin/dash
#
# temp_mon3 Smythies 2016.10.05
# a simplified version of temp_mon2,
# for monitoring temp.
# Note: it is on purpose that -a is not used.
# Also CPU0 frequency (1 is good enough, when all
# are loaded).
#
# temp_mon2 Smythies 2016.09.29
# Monitor Package temperatures.
# Use clock modulation to control temps.
# i.e. simulate the second to last level
# of defense.
# Use simple primatives.
# run as sudo
# hardcoded for my tcc of 98 degrees.
#
echo ... begin package temperature monitoring ...
#
# In case I forgot (which I often do)
modprobe msr
#
# first let the drastic effect of the sudo command decay
# Done later in temp_mon3.
#
# some stuff
COMMAND="rdmsr --bitfield 22:16 -u 0x1B1"
COMMAND2="cat /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq"
#
# then get on with it
while [ 1 ];do
sleep 4
TEMP_RAW=$(eval $COMMAND)
CPU0_FREQ=$(eval $COMMAND2)
TEMP_ACT=$((98-TEMP_RAW))
echo "$TEMP_ACT $CPU0_FREQ"
done
这是一些示例输出,一段时间后我在其中添加了一些CPU负载(温度从31度到73度):
$ sudo ./temp_mon3
[sudo] password for doug:
... begin package temperature monitoring ...
31 1605275
31 1605154
32 1605164
30 1605148
31 1605176
51 3511279
54 3511278
55 3511279
57 3511283
58 3511279
60 3511278
61 3511284
63 3511279
64 3511280
64 3511280
66 3511280
67 3511278
68 3511280
68 3511281
69 3511278
71 3511280
70 3511281
71 3511281
71 3511280
72 3511276
72 3511277
73 3511283
73 3511279
^C