1. 程式人生 > 其它 >linux系統中檢視邏輯cpu個數、物理cpu個數、每個cpu的核心數、cpu型號

linux系統中檢視邏輯cpu個數、物理cpu個數、每個cpu的核心數、cpu型號

1、邏輯cpu個數(執行緒數)

[root@centos79 test]# cat /proc/cpuinfo | grep "processor"
processor       : 0
processor       : 1
processor       : 2
processor       : 3
[root@centos79 test]# cat /proc/cpuinfo | grep "processor" | wc -l
4

2、物理cpu個數

[root@centos79 test]# cat /proc/cpuinfo | grep "physical id"
physical id     : 
0 physical id : 0 physical id : 1 physical id : 1 [root@centos79 test]# cat /proc/cpuinfo | grep "physical id" | sort | uniq -c 2 physical id : 0 2 physical id : 1 [root@centos79 test]# cat /proc/cpuinfo | grep "physical id" | sort | uniq -c | wc -l 2

3、檢視每個cpu核心數

[root@centos79 test]# cat /proc/cpuinfo | grep "
cpu cores" cpu cores : 2 cpu cores : 2 cpu cores : 2 cpu cores : 2 [root@centos79 test]# cat /proc/cpuinfo | grep "cpu cores" | uniq | awk -F: '{print $2}' 2

4、檢視cpu型號

[root@centos79 test]# dmidecode -s processor-version | uniq
AMD Ryzen 5 3600X 6-Core Processor

5、彙總

[root@centos79 test]# lscpu
Architecture:          x86_64
CPU op
-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 ## 邏輯cpu個數 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 2 ## 每個cpu核心數 Socket(s): 2 ## 物理cpu個數 NUMA node(s): 1 Vendor ID: AuthenticAMD CPU family: 23 Model: 113 Model name: AMD Ryzen 5 3600X 6-Core Processor ## cpu型號 Stepping: 0 CPU MHz: 3800.009 BogoMIPS: 7600.01 Virtualization: AMD-V Hypervisor vendor: VMware Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 512K L3 cache: 32768K NUMA node0 CPU(s): 0-3 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 art rep_good nopl tsc_reliable nonstop_tsc extd_apicid eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw perfctr_core retpoline_amd ssbd ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec clzero arat npt svm_lock nrip_save vmcb_clean flushbyasid decodeassists overflow_recov succor