Linux/CPU:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第149行: 第149行:
</syntaxhighlight>|<syntaxhighlight lang="javascript">
</syntaxhighlight>|<syntaxhighlight lang="javascript">
64
64
</syntaxhighlight>|root@kangjian:~#}}
== 超线程 ==
如果有两个逻辑 CPU 具有相同的 <code>core id</code>,则超线程已经被打开。
{{shc_out|<syntaxhighlight lang="bash">
cat /proc/cpuinfo
</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:~#}}
</syntaxhighlight>|root@kangjian:~#}}

2020年6月17日 (三) 01:40的版本

引言

查看 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
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