linux直接用命令查看主机cpu型号,个数,逻辑c个数,核心数
2019/10/10/17:45:14 阅读:2239 来源:谷歌SEO算法 标签:
Google
有时候我们购买的新主机,想查询一下硬件配置是不是商家说的一样(你懂的),这时我们可以不用第三方式工具,直接用Linux命令就可以查询到cpu型号,物理cpu个数,逻辑cpu个数,cpu核心数。
无需第三方工具,proc文件系统里面的/proc/cpuinfo提供了丰富的cpu信息,其输出类似如下:
- processor:0
- vendor_id:AuthenticAMD
- cpufamily:16
- model:4
- modelname:Quad-CoreAMDOpteron(tm)Processor8382
- stepping:2
- microcode:0x1000086
- cpuMHz:2611.977
- cachesize:512KB
- physicalid:0
- siblings:4
- coreid:0
- cpucores:4
- apicid:4
- initialapicid:0
- fpu:yes
- fpu_exception:yes
- cpuidlevel:5
- wp:yes
- flags:fpuvmedepsetscmsrpaemcecx8apicsepmtrrpgemcacmovpatpse36clflushmmxfxsrssesse2htsyscallnxmmxextfxsr_optpdpe1gbrdtscplm3dnowext3dnowconstant_tscrep_goodnoplnonstop_tscextd_apicidpnimonitorcx16popcntlahf_lmcmp_legacysvmextapiccr8_legacyabmsse4amisalignsse3dnowprefetchosvwibsskinitwdthw_pstatenptlbrvsvm_locknrip_save
- bogomips:5223.95//phpfensi.com
- TLBsize:10244Kpages
- clflushsize:64
- cache_alignment:64
- addresssizes:48bitsphysical,48bitsvirtual
- powermanagement:tsttptmstc100mhzstepshwpstate
型号和逻辑CPU个数:
- $cat/proc/cpuinfo|grep'modelname'|cut-f2-d:|uniq-c
- 32Quad-CoreAMDOpteron(tm)Processor8382
可以看到有32个逻辑CPU,后面是型号,物理CPU个数:
- $cat/proc/cpuinfo|grep'physicalid'|uniq-d
- physicalid:0
- physicalid:1
- physicalid:2
- physicalid:3
- physicalid:4
- physicalid:5
- physicalid:6
- physicalid:7
- //或者
- $cat/proc/cpuinfo|grep'physicalid'|uniq-d|cut-f1-d:|uniq-c
- 8physicalid
可以看到有8颗物理CPU,每颗CPU核心数:
- $cat/proc/cpuinfo|grep'cpucores'|uniq
- cpucores:4
- //或者
- $cat/proc/cpuinfo|grep'coreid'|sort|uniq
- coreid:0
- coreid:1
- coreid:2
- coreid:3
8*4刚好是32颗逻辑CPU,如果有超线程技术则不是简单的相乘就可以,还要乘以每个核心的线程数,还有一个命令lscpu,可以总览系统cpu概况:
- $lscpu
- Architecture:x86_64
- CPUop-mode(s):32-bit,64-bit
- ByteOrder:LittleEndian
- CPU(s):32
- On-lineCPU(s)list:0-31
- Thread(s)percore:1
- Core(s)persocket:4
- Socket(s):8
- NUMAnode(s):4
- VendorID:AuthenticAMD
- CPUfamily:16
- Model:4
- Stepping:2
- CPUMHz:2611.977
- BogoMIPS:5224.55
- Virtualization:AMD-V
- L1dcache:64K
- L1icache:64K
- L2cache:512K
- L3cache:6144K
- NUMAnode0CPU(s):0-3
- NUMAnode1CPU(s):4-7
- NUMAnode2CPU(s):8-11
- NUMAnode3CPU(s):12-31
热门评论