cpuinfo

CPUINFO

/proc/cpuinfo详解

  1$ cat /proc/cpuinfo
  2processor       : 0  #逻辑处理器编号,从0开始
  3vendor_id       : GenuineIntel #设备商ID,这里是Intel
  4cpu family      : 6 #CPU系列代号
  5model           : 60 #CPU系列中的某一代代号
  6model name      : Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz #CPU名,包含型号和主频等信息
  7stepping        : 3 # 步进编号,标识处理器的设计或制作版本
  8microcode       : 0x27 #CPU微代码
  9cpu MHz         : 2700.000 #CPU主频
 10cache size      : 3072 KB #CPU二级cache大小
 11physical id     : 0 #物理CPU的编号
 12siblings        : 4 #一个物理CPU有几个逻辑CPU
 13core id         : 0 #一个物理CPU上的每个内核的唯一标识符,不同物理CPU的core id可以相同,因为每个CPU上的core id都从0开始标识
 14cpu cores       : 2 #物理CPU核心数
 15apicid          : 0 #用来区分不同逻辑核的编号
 16initial apicid  : 0
 17fpu             : yes #是否具有浮点运算单元
 18fpu_exception   : yes #是否支持浮点计算异常
 19cpuid level     : 17 #执行cpuid指令前,eax寄存器中的值,不同cpuid指令会返回不同内容
 20wp              : yes #表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection)
 21flags           : 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
 22bogomips        : 5400.00 #在系统内核启动时粗略测算的CPU速度
 23clflush size    : 64 #每次刷新缓存的大小单位
 24cache_alignment : 64 #缓存地址对齐单位
 25address sizes   : 39 bits physical, 48 bits virtual #可访问地址空间位数    
 26power management: #电源管理相关
 27processor       : 1
 28vendor_id       : GenuineIntel
 29cpu family      : 6
 30model           : 60
 31model name      : Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz
 32stepping        : 3
 33microcode       : 0x27
 34cpu MHz         : 2700.000
 35cache size      : 3072 KB
 36physical id     : 0
 37siblings        : 4
 38core id         : 0
 39cpu cores       : 2
 40apicid          : 1
 41initial apicid  : 1
 42fpu             : yes
 43fpu_exception   : yes
 44cpuid level     : 17
 45wp              : yes
 46flags           : 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
 47bogomips        : 5400.00
 48clflush size    : 64
 49cache_alignment : 64
 50address sizes   : 39 bits physical, 48 bits virtual
 51power management:
 52processor       : 2
 53vendor_id       : GenuineIntel
 54cpu family      : 6
 55model           : 60
 56model name      : Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz
 57stepping        : 3
 58microcode       : 0x27
 59cpu MHz         : 2700.000
 60cache size      : 3072 KB
 61physical id     : 0
 62siblings        : 4
 63core id         : 1
 64cpu cores       : 2
 65apicid          : 2
 66initial apicid  : 2
 67fpu             : yes
 68fpu_exception   : yes
 69cpuid level     : 17
 70wp              : yes
 71flags           : 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
 72bogomips        : 5400.00
 73clflush size    : 64
 74cache_alignment : 64
 75address sizes   : 39 bits physical, 48 bits virtual
 76power management:
 77processor       : 3
 78vendor_id       : GenuineIntel
 79cpu family      : 6
 80model           : 60
 81model name      : Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz
 82stepping        : 3
 83microcode       : 0x27
 84cpu MHz         : 2700.000
 85cache size      : 3072 KB
 86physical id     : 0
 87siblings        : 4
 88core id         : 1
 89cpu cores       : 2
 90apicid          : 3
 91initial apicid  : 3
 92fpu             : yes
 93fpu_exception   : yes
 94cpuid level     : 17
 95wp              : yes
 96flags           : 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
 97bogomips        : 5400.00
 98clflush size    : 64
 99cache_alignment : 64
100address sizes   : 39 bits physical, 48 bits virtual
101power management:

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

查看CPU型号

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

查询物理CPU数

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

查询物理CPU核心数

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

查询CPU核心数和线程数

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

查询逻辑CPU数

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

查看CPU主频

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

使用lscpu查看cpu信息

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