Linux/CPU:修订间差异
来自康健生活
< Linux
创建页面,内容为“== cpu 温度 == <syntaxhighlight lang="Bash"> sudo apt-get install lm-sensors hddtemp sudo sensors-detect sensors</syntaxhighlight> <blockquote><pre> asus-isa-0000…” |
|||
| (未显示同一用户的3个中间版本) | |||
| 第1行: | 第1行: | ||
== 引言 == | |||
查看 CPU 信息。 | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
cat /proc/cpuinfo | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
processor : 0 | |||
vendor_id : GenuineIntel | |||
... | |||
address sizes : 39 bits physical, 48 bits virtual | |||
power management: | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
CPU 个数。 | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
more /proc/cpuinfo |grep "physical id"|uniq|wc -l | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
1 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
线程数。 | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
cat /proc/cpuinfo | grep processor | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
12 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
more /proc/cpuinfo |grep "physical id"|grep "0"|wc -l | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
processor : 0 | |||
processor : 1 | |||
processor : 2 | |||
processor : 3 | |||
processor : 4 | |||
processor : 5 | |||
processor : 6 | |||
processor : 7 | |||
processor : 8 | |||
processor : 9 | |||
processor : 10 | |||
processor : 11 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
物理 CPU。 | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
1 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
逻辑 CPU。 | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
cat /proc/cpuinfo |grep "processor"|wc -l | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
12 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
核心。 | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
cat /proc/cpuinfo |grep "cores"|uniq | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
cpu cores : 6 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
== cpu 温度 == | == cpu 温度 == | ||
<syntaxhighlight lang="Bash"> | <syntaxhighlight lang="Bash"> | ||
| 第34行: | 第96行: | ||
sudo apt-get install psensor | sudo apt-get install psensor | ||
psensor</syntaxhighlight> | psensor</syntaxhighlight> | ||
== 其他 == | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
uname -a | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
Linux kangjian 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
12 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
cat /proc/cpuinfo | grep physical | uniq -c | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
1 physical id : 0 | |||
1 address sizes : 39 bits physical, 48 bits virtual | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
12 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
操作系统位数。 | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
getconf LONG_BIT | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
64 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
== 超线程 == | |||
如果有两个逻辑 CPU 具有相同的 <code>core id</code>,则超线程已经被打开。 | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
cat /proc/cpuinfo | grep "core id" | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
core id : 0 | |||
core id : 1 | |||
core id : 2 | |||
core id : 3 | |||
core id : 4 | |||
core id : 5 | |||
core id : 0 | |||
core id : 1 | |||
core id : 2 | |||
core id : 3 | |||
core id : 4 | |||
core id : 5 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
== 关闭睿频 == | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
限制CPU最大频率到50% | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
echo "50" | sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
实时查看频率: | |||
{{shc_out|<syntaxhighlight lang="bash"> | |||
watch -n 0 "cat /proc/cpuinfo | grep -i mhz" | |||
</syntaxhighlight>|<syntaxhighlight lang="javascript"> | |||
cpu MHz : 800.022 | |||
cpu MHz : 800.013 | |||
cpu MHz : 800.049 | |||
cpu MHz : 800.025 | |||
cpu MHz : 800.049 | |||
cpu MHz : 800.114 | |||
cpu MHz : 800.015 | |||
cpu MHz : 800.052 | |||
cpu MHz : 800.179 | |||
cpu MHz : 800.113 | |||
cpu MHz : 800.045 | |||
cpu MHz : 800.007 | |||
</syntaxhighlight>|root@kangjian:~#}} | |||
2020年6月17日 (三) 02:05的最新版本
引言
查看 CPU 信息。
root@kangjian:~#
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
...
address sizes : 39 bits physical, 48 bits virtual
power management:
CPU 个数。
root@kangjian:~#
more /proc/cpuinfo |grep "physical id"|uniq|wc -l
1
线程数。
root@kangjian:~#
cat /proc/cpuinfo | grep processor
12
root@kangjian:~#
more /proc/cpuinfo |grep "physical id"|grep "0"|wc -l
processor : 0
processor : 1
processor : 2
processor : 3
processor : 4
processor : 5
processor : 6
processor : 7
processor : 8
processor : 9
processor : 10
processor : 11
物理 CPU。
root@kangjian:~#
cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
1
逻辑 CPU。
root@kangjian:~#
cat /proc/cpuinfo |grep "processor"|wc -l
12
核心。
root@kangjian:~#
cat /proc/cpuinfo |grep "cores"|uniq
cpu cores : 6
cpu 温度
sudo apt-get install lm-sensors hddtemp
sudo sensors-detect
sensors
asus-isa-0000 Adapter: ISA adapter cpu_fan: 0 RPM acpitz-acpi-0 Adapter: ACPI interface temp1: +27.8°C (crit = +119.0°C) temp2: +29.8°C (crit = +119.0°C) amdgpu-pci-0100 Adapter: PCI adapter vddgfx: +1.00 V fan1: 1287 RPM (min = 0 RPM, max = 4100 RPM) edge: +48.0°C (crit = +94.0°C, hyst = -273.1°C) power1: 24.17 W (cap = 130.00 W) coretemp-isa-0000 Adapter: ISA adapter Package id 0: +33.0°C (high = +82.0°C, crit = +100.0°C) Core 0: +32.0°C (high = +82.0°C, crit = +100.0°C) Core 1: +33.0°C (high = +82.0°C, crit = +100.0°C) Core 2: +31.0°C (high = +82.0°C, crit = +100.0°C) Core 3: +32.0°C (high = +82.0°C, crit = +100.0°C) Core 4: +32.0°C (high = +82.0°C, crit = +100.0°C) Core 5: +31.0°C (high = +82.0°C, crit = +100.0°C)
sudo apt-get install psensor
psensor
其他
root@kangjian:~#
uname -a
Linux kangjian 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
root@kangjian:~#
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
12 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
root@kangjian:~#
cat /proc/cpuinfo | grep physical | uniq -c
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
1 physical id : 0
1 address sizes : 39 bits physical, 48 bits virtual
root@kangjian:~#
cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
12
操作系统位数。
root@kangjian:~#
getconf LONG_BIT
64
超线程
如果有两个逻辑 CPU 具有相同的 core id,则超线程已经被打开。
root@kangjian:~#
cat /proc/cpuinfo | grep "core id"
core id : 0
core id : 1
core id : 2
core id : 3
core id : 4
core id : 5
core id : 0
core id : 1
core id : 2
core id : 3
core id : 4
core id : 5
关闭睿频
root@kangjian:~#
echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo
限制CPU最大频率到50%
root@kangjian:~#
echo "50" | sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct
实时查看频率:
root@kangjian:~#
watch -n 0 "cat /proc/cpuinfo | grep -i mhz"
cpu MHz : 800.022
cpu MHz : 800.013
cpu MHz : 800.049
cpu MHz : 800.025
cpu MHz : 800.049
cpu MHz : 800.114
cpu MHz : 800.015
cpu MHz : 800.052
cpu MHz : 800.179
cpu MHz : 800.113
cpu MHz : 800.045
cpu MHz : 800.007
No categories