首页 > 系统 > Linux > 正文

Shell实现识别物理cpu个数、核心数

2019-10-26 18:44:10
字体:
来源:转载
供稿:网友

如何识别物理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

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表