天天看点

linux下查看CPU信息

总核数 = 物理CPU个数 * 每个物理CPU上的核数

总逻辑CPU总数 = 物理CPU个数 * 每个物理CPU上的核数 (cpu cores)*  超线程数(与CPU架构有关,支持并开启ht)

查看-物理CPU个数

cat /proc/cpuinfo |grep "physical id"|sort |uniq |wc -l      

查看-每个物理CPU上的核数

cat /proc/cpuinfo| grep "cpu cores"| uniq      

查看逻辑CPU个数

cat /proc/cpuinfo |grep "processor"|sort |uniq |wc -l      

是否开启intel的超线程技术(ht)

如果有两个逻辑CPU具有相同的"core id",那么超线程是打开的。

也可以根据以下原则,来判断是否支持HT技术。如果"siblings"和"cpu cores"一致,则说明不支持超线程,或者超线程未打开;如果"siblings"是"cpu cores"的两倍,则说明支持超线程,并且超线程已打开。

linux下查看CPU信息

 /proc/cpuinfo文件分析

 cpu family  :6

model    :26

model name :Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz

stepping    :5

cpu MHz    :1600.000

cache size  : 8192 KB

physical id  :0

siblings    :8

core id     : 0

cpu cores   :4

apicid         :0

fpu       :yes

fpu_exception :yes

cpuid level   : 11

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 syscall nx rdtscp lm constant_tsc ida nonstop_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr popcnt lahf_lm

bogomips   :4522.12

clflush size  :64

cache_alignment  : 64

address sizes    : 40 bits physical, 48 bits virtual

power management :

以上输出项的含义如下:

processor :系统中逻辑处理核的编号。对于单核处理器,则课认为是其CPU编号,对于多核处理器则可以是物理核、或者使用超线程技术虚拟的逻辑核

vendor_id :CPU制造商     

cpu family :CPU产品系列代号

model   :CPU属于其系列中的哪一代的代号

model name:CPU属于的名字及其编号、标称主频

stepping   :CPU属于制作更新版本

cpu MHz   :CPU的实际使用主频

cache size   :CPU二级缓存大小

physical id   :单个CPU的标号

siblings       :单个CPU逻辑物理核数

core id        :当前物理核在其所处CPU中的编号,这个编号不一定连续

cpu cores    :该逻辑核所处CPU的物理核数

apicid          :用来区分不同逻辑核的编号,系统中每个逻辑核的此编号必然不同,此编号不一定连续

fpu             :是否具有浮点运算单元(Floating Point Unit)

fpu_exception  :是否支持浮点计算异常

cpuid level   :执行cpuid指令前,eax寄存器中的值,根据不同的值​​​cpuid​​​指令会返回不同的内容

wp             :表明当前CPU是否在内核态支持对用户空间的写保护(Write Protection)

flags          :当前CPU支持的功能

​​​bogomips​​​   :在系统内核启动时粗略测算的CPU速度(Million Instructions Per Second)

clflush size  :每次刷新缓存的大小单位

cache_alignment :缓存地址对齐单位

address sizes     :可访问地址空间位数

power management :对能源管理的支持

参考文档:​

 cpu family  :6

model    :26

model name :Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz

stepping    :5

cpu MHz    :1600.000

cache size  : 8192 KB

physical id  :0

siblings    :8

core id     : 0

cpu cores   :4

apicid         :0

fpu       :yes

fpu_exception :yes

cpuid level   : 11

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 syscall nx rdtscp lm constant_tsc ida nonstop_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr popcnt lahf_lm

bogomips   :4522.12

clflush size  :64

cache_alignment  : 64

address sizes    : 40 bits physical, 48 bits virtual

power management :

以上输出项的含义如下:

继续阅读