在linux中提供了proc文件系统用于显示系统的软硬件信息,cat /proc/cpuinfo 可以查看cpu 内存信息
/proc/cpuinfo 详细内容
[root@Ceph-251 ~]# cat /proc/cpuinfo | more
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Xeon(R) Gold 6230N CPU @ 2.30GHz
stepping : 7
microcode : 0x5003006
cpu MHz : 1000.012
cache size : 28160 KB
physical id : 0
siblings : 40
core id : 0
cpu cores : 20
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb r
dtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3
sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat
_l3 cdp_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpci
d rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc
cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp_epp pku avx512_vnni md_clear flush_l1d arch_capabilities
bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs taa itlb_multihit
bogomips : 4600.00
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
各行具体含义:
- cache size:CPU二级缓存的大小
- cpu cores:逻辑核所在CPU的物理核数
- physical id:单个物理CPU标号
- processor:系统中逻辑处理核心的数量,后面紧跟的是processor id
- siblings:单个物理 CPU 的逻辑 CPU 数量
根据该文件获取主机信息
- 查看物理cpu个数
cat /proc/cpuinfo | grep 'physical id' | sort -u | wc -l