物理 CPU 核數
$ cat /proc/cpuinfo | grep "cpu cores"| uniq
cpu cores : 4
$ cat /proc/cpuinfo | grep "cpu cores"| wc -l
4
邏輯 CPU 核數
$ cat /proc/cpuinfo| grep "processor"| uniq
processor : 0
processor : 1
processor : 2
processor : 3
processor : 4
processor : 5
processor : 6
processor : 7
$ cat /proc/cpuinfo| grep "processor"| wc -l
8
/proc/cpuinfo
解析
$ cat /proc/cpuinfo
輸出結果
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz
stepping : 4
microcode : 0x2006906
cpu MHz : 3398.864
cache size : 25344 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 xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq 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 invpcid_single pti fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit
bogomips : 6000.00
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
- processor - 處理器的一個標識號。比如機器爲一核,則爲0,爲多核,則爲 0,1,2...
- cpu family - 標識處理器的類型。對於基於Intel的系統,將數字放在“86”前面以確定該值。這對於識別舊系統(例如586、486或386)特別有用。由於爲這些特定體系結構中的每種體系結構編譯了一些RPM軟件包,因此該值還可以幫助用戶確定要安裝的軟件包
- model name - 顯示處理器的通用名稱,包括其項目名稱
- cpu MHz - 以兆赫爲單位顯示處理器的精確速度,精確到千分之一位
- cache size - 2級內存緩存容量
- siblings - 超線程機器在同一物理CPU上的同級CPU的數量
- flags - 定義有關處理器的多種不同質量,例如浮點單元(FPU)的存在以及處理MMX指令的能力