Linux 查看CPU信息

总核数 = 物理CPU个数 X 每颗物理CPU的核数
总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数

查看物理CPU个数

1
2
[root@caoxl ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
1

查看每个物理CPU中core的个数(即核数)

1
2
[root@caoxl ~]# cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores : 1

查看逻辑CPU的个数

1
2
[root@caoxl ~]# cat /proc/cpuinfo | grep "processor" | wc -l
2

查看位于相同物理封装的处理器中的逻辑处理器的数量。

1
2
[root@caoxl ~]# cat /proc/cpuinfo | grep "siblings" | sort | uniq
siblings : 2

查看CPU信息(型号)

1
2
[root@caoxl ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
2 Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz

/proc/cpuinfo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
[root@caoxl ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz
stepping : 1
microcode : 0x1
cpu MHz : 2499.996
cache size : 40960 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt spec_ctrl intel_stibp
bogomips : 4999.99
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 79
model name : Intel(R) Xeon(R) CPU E5-2682 v4 @ 2.50GHz
stepping : 1
microcode : 0x1
cpu MHz : 2499.996
cache size : 40960 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt spec_ctrl intel_stibp
bogomips : 4999.99
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
  • 以上输出项的含义如下:

processor :系统中逻辑处理核的编号。对于单核处理器,则可认为是其CPU编号,对于多核处理器则可以是物理核、或者使用超线程技术虚拟的逻辑核
vendor_id:CPU制造商
cpu family:CPU产品系列代号
model:CPU属于其系列中的哪一代的代号
model name:CPU属于的名字及其编号、标称主频
stepping:CPU属于制作更新版本
cpu MHz:CPU的实际使用主频
cache size:CPU二级缓存大小
physical id:单个CPU的标号
siblings:单个CPU逻辑物理核数
core id:当前物理核在其所处CPU中的编号,这个编号不一定连续
cpu cores:该逻辑核所处CPU的物理核数
apicid:用来区分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续
fpu:是否具有浮点运算单元(Floating Point Unit)
fpu_exception:是否支持浮点计算异常
cpuid level:执行cpuid指令前,eax寄存器中的值,根据不同的值cpuid指令会返回不同的内容
wp:表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection)
flags:当前CPU支持的功能
bogomips:在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second)
clflush size:每次刷新缓存的大小单位
cache_alignment:缓存地址对齐单位
address sizes:可访问地址空间位数
power management:对能源管理的支持

lscpu命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@caoxl ~]# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 24
On-line CPU(s) list: 0-23
Thread(s) per core: 2
Core(s) per socket: 12
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
Stepping: 4
CPU MHz: 2494.132
BogoMIPS: 4988.26
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 1024K
L3 cache: 33792K
NUMA node0 CPU(s): 0-23

Powered by Hexo and Hexo-theme-hiker

Copyright © 2017 - 2023 Keep It Simple And Stupid All Rights Reserved.

访客数 : | 访问量 :