Home

CPUINFO #

/proc/cpuinfo详解 #

$ cat /proc/cpuinfo
processor       : 0  #逻辑处理器编号,从0开始
vendor_id       : GenuineIntel #设备商ID,这里是Intel
cpu family      : 6 #CPU系列代号
model           : 60 #CPU系列中的某一代代号
model name      : Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz #CPU名,包含型号和主频等信息
stepping        : 3 # 步进编号,标识处理器的设计或制作版本
microcode       : 0x27 #CPU微代码
cpu MHz         : 2700.000 #CPU主频
cache size      : 3072 KB #CPU二级cache大小
physical id     : 0 #物理CPU的编号
siblings        : 4 #一个物理CPU有几个逻辑CPU
core id         : 0 #一个物理CPU上的每个内核的唯一标识符,不同物理CPU的core id可以相同,因为每个CPU上的core id都从0开始标识
cpu cores       : 2 #物理CPU核心数
apicid          : 0 #用来区分不同逻辑核的编号
initial apicid  : 0
fpu             : yes #是否具有浮点运算单元
fpu_exception   : yes #是否支持浮点计算异常
cpuid level     : 17 #执行cpuid指令前,eax寄存器中的值,不同cpuid指令会返回不同内容
wp              : yes #表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection)
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc arch_perfmon rep_good nopl xtopology cpuid aperfmperf pni pclmuldq est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida pln pts md_clear flush_l1d arch_capabilities
bogomips        : 5400.00 #在系统内核启动时粗略测算的CPU速度
clflush size    : 64 #每次刷新缓存的大小单位
cache_alignment : 64 #缓存地址对齐单位
address sizes   : 39 bits physical, 48 bits virtual #可访问地址空间位数    
power management: #电源管理相关
processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz
stepping        : 3
microcode       : 0x27
cpu MHz         : 2700.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 17
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc arch_perfmon rep_good nopl xtopology cpuid aperfmperf pni pclmuldq est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida pln pts md_clear flush_l1d arch_capabilities
bogomips        : 5400.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:
processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz
stepping        : 3
microcode       : 0x27
cpu MHz         : 2700.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 17
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc arch_perfmon rep_good nopl xtopology cpuid aperfmperf pni pclmuldq est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida pln pts md_clear flush_l1d arch_capabilities
bogomips        : 5400.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:
processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz
stepping        : 3
microcode       : 0x27
cpu MHz         : 2700.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 3
initial apicid  : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 17
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc arch_perfmon rep_good nopl xtopology cpuid aperfmperf pni pclmuldq est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm epb fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida pln pts md_clear flush_l1d arch_capabilities
bogomips        : 5400.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

关于CPU的一些快捷查询命令 #

查看CPU型号 #

$ cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
      4  Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz

查询物理CPU数 #

$ cat  /proc/cpuinfo | grep "physical id" |sort |uniq
physical id     : 0 # 一个cpu编号为0

查询物理CPU核心数 #

$ cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores       : 2 # 2个核心

查询CPU核心数和线程数 #

$ cat /proc/cpuinfo | grep -e "cpu cores"  -e "siblings" | sort | uniq
cpu cores       : 2  # 2核心
siblings        : 4  # 4线程

查询逻辑CPU数 #

$ cat /proc/cpuinfo | grep "processor" | wc -l
4

查看CPU主频 #

$ cat  /proc/cpuinfo | grep MHz | uniq
cpu MHz         : 2700.000

使用lscpu查看cpu信息 #

➜  ~ lscpu
Architecture:                         x86_64 # 构架,这里时64位
CPU op-mode(s):                       32-bit, 64-bit # CPU支持的模式:32位、64位
Byte Order:                           Little Endian #字节排序的模式,常用小端模式
Address sizes:                        42 bits physical, 48 bits virtual
CPU(s):                               2 #逻辑CPU数量
On-line CPU(s) list:                  0,1 #在线的cpu数量 有些时候为了省电或者过热的时候,某些CPU会停止运行
Thread(s) per core:                   2 #每个核心支持的线程数
Core(s) per socket:                   1 #每颗物理cpu的核数
Socket(s):                            1 #主板上插CPU的槽的数量,即物理cpu数量
NUMA node(s):                         1
Vendor ID:                            AuthenticAMD #cpu厂商ID
CPU family:                           25 #CPU系列
Model:                                1 #CPU型号
Model name:                           General Purpose Processor #CPU名
Stepping:                             1 #步进
CPU MHz:                              2449.762 #cpu主频
BogoMIPS:                             4899.52 #MIPS是每秒百万条指令,Bogo是Bogus(伪)的意思,这里是估算MIPS值
Hypervisor vendor:                    KVM 
Virtualization type:                  full #cpu支持的虚拟化技术
L1d cache:                            32 KiB #一级高速缓存 dcache 用来存储数据
L1i cache:                            32 KiB #一级高速缓存 icache 用来存储指令
L2 cache:                             512 KiB #二级缓存
L3 cache:                             32 MiB #三级缓存 缓存速度上 L1 > L2 > L3 > DDR(内存)
NUMA node0 CPU(s):                    0,1
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Mitigation; safe RET, no microcode
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
                                      and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer
                                      sanitization
Vulnerability Spectre v2:             Vulnerable, IBPB: disabled, STIBP: disabled, PBRSB-eIBRS
                                      : Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
                                       cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx
                                      mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good
                                      nopl nonstop_tsc cpuid extd_apicid tsc_known_freq pni pc
                                      lmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe p
                                      opcnt tsc_deadline_timer aes xsave avx f16c rdrand hyper
                                      visor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignss
                                      e 3dnowprefetch osvw topoext perfctr_core invpcid_single
                                       ssbd ibrs ibpb stibp vmmcall fsgsbase tsc_adjust bmi1 a
                                      vx2 smep bmi2 erms invpcid rdseed adx smap clflushopt cl
                                      wb sha_ni xsaveopt xsavec xgetbv1 xsaves clzero xsaveerp
                                      tr wbnoinvd arat umip vaes vpclmulqdq fsrm arch_capabili
                                      ties