如何识别物理cpu个数,几个核,是超线程还是多核心

判断依据:
1.具有相同core id的cpu是同一个core的超线程。
2.具有相同physical id的cpu是同一颗cpu封装的线程或者cores。

英文版:
1.Physical id and core id are not necessarily consecutive but they are unique. Any cpu with the same core id are hyperthreads in the same core.
2.Any cpu with the same physical id are threads or cores in the same physical socket.

实例:

LunarPages的CPU信息:

processor        : 0
vendor_id        : GenuineIntel
cpu family        : 15
model                : 4
model name        : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz                : 3000.881
cache size        : 2048 KB
physical id        : 0
siblings        : 2
core id                : 0
cpu cores        : 1
fdiv_bug        : no
hlt_bug                : no
f00f_bug        : no
coma_bug        : no
fpu                : yes
fpu_exception        : yes
cpuid level        : 5
wp                : yes
flags                : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl cid xtpr
bogomips        : 6006.73

processor        : 1
vendor_id        : GenuineIntel
cpu family        : 15
model                : 4
model name        : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz                : 3000.881
cache size        : 2048 KB
physical id        : 0
siblings        : 2
core id                : 0
cpu cores        : 1
fdiv_bug        : no
hlt_bug                : no
f00f_bug        : no
coma_bug        : no
fpu                : yes
fpu_exception        : yes
cpuid level        : 5
wp                : yes
flags                : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl cid xtpr
bogomips        : 5999.40

processor        : 2
vendor_id        : GenuineIntel
cpu family        : 15
model                : 4
model name        : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz                : 3000.881
cache size        : 2048 KB
physical id        : 3
siblings        : 2
core id                : 3
cpu cores        : 1
fdiv_bug        : no
hlt_bug                : no
f00f_bug        : no
coma_bug        : no
fpu                : yes
fpu_exception        : yes
cpuid level        : 5
wp                : yes
flags                : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl cid xtpr
bogomips        : 5999.08

processor        : 3
vendor_id        : GenuineIntel
cpu family        : 15
model                : 4
model name        : Intel(R) Xeon(TM) CPU 3.00GHz
stepping        : 3
cpu MHz                : 3000.881
cache size        : 2048 KB
physical id        : 3
siblings        : 2
core id                : 3
cpu cores        : 1
fdiv_bug        : no
hlt_bug                : no
f00f_bug        : no
coma_bug        : no
fpu                : yes
fpu_exception        : yes
cpuid level        : 5
wp                : yes
flags                : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc pni monitor ds_cpl cid xtpr
bogomips        : 5999.55

显示4个逻辑CPU,通过physical id  ,前面两个逻辑cpu的相同,后面两个的相同,所以有两个物理CPU。前面两个的 core id相同,后面的两个core ID相同,说明这两个CPU都是单核。也就是说两个单核cpu,启用了超线程技术。
通过intel的cpu的参数可以初步判断 使用的是两个 Xeon奔腾4CPU ,有点差。。。。
如何获得CPU的详细信息:

linux命令:cat /proc/cpuinfo

用命令判断几个物理CPU,几个核等:

逻辑CPU个数:
# cat /proc/cpuinfo | grep “processor” | wc -l

物理CPU个数:
# cat /proc/cpuinfo | grep “physical id” | sort | uniq | wc -l

每个物理CPU中Core的个数:
# cat /proc/cpuinfo | grep “cpu cores” | wc -l

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

每个物理CPU中逻辑CPU(可能是core, threads或both)的个数:
# cat /proc/cpuinfo | grep “siblings”
其他特征:

目前intel新的多核心cpu都会在后面显示具体的型号数字,例如:

model name        : Intel(R) Xeon(R) CPU           X3230  @ 2.66GHz

说明是 Xeon 3230的cpu,而不显示型号的具体数字的,大部分都是奔腾的CPU

很多主机商都骗人,用奔腾的cpu,却说是多核心的CPU。

探针看到的数据

类型:Intel(R) Xeon(TM) CPU 2.80GHz 缓存:1024 KB
类型:Intel(R) Xeon(TM) CPU 2.80GHz 缓存:1024 KB
类型:Intel(R) Xeon(TM) CPU 2.80GHz 缓存:1024 KB
类型:Intel(R) Xeon(TM) CPU 2.80GHz 缓存:1024 KB

没有具体的型号,缓存1M,一般都是奔腾系列的cpu,或者是intel假双核的cpu,具体要根据上面说的去判断。新的多核心cpu都能看到具体的型号。
另外多核心的xeon的CPU,一般主频都不高,达到2.8和3.0的只有很少的几个高端CPU型号,一般主机商不会用这么好的
大漠孤狼整理,首发站长百科论坛http://bbs.zzbaike.com)转载请注明。

Post Footer automatically generated by wp-posturl plugin for wordpress.

June 4th, 2009  in 服务器技术 4 Comments »

4 Responses to “如何识别物理cpu个数,几个核,是超线程还是多核心”

Leave a Reply