醋泡姜泡多长时间能吃:识别cpu个数、核心、超线程、多核心(Linux)

来源:百度文库 编辑:中财网 时间:2024/04/30 00:21:35
Linux下如何识别物理cpu个数,几个核,是超线程还是多核心cat /proc/cpuinfo |grep physical |sort -u |wc -l  此命令为查看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        : 0vendor_id        : GenuineIntelcpu family        : 15model                : 4model name        : Intel(R) Xeon(TM) CPU 3.00GHzstepping        : 3cpu MHz                : 3000.881cache size        : 2048 KBphysical id        : 0siblings        : 2core id                : 0cpu cores        : 1fdiv_bug        : nohlt_bug                : nof00f_bug        : nocoma_bug        : nofpu                : yesfpu_exception        : yescpuid level        : 5wp                : yesflags                : 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 xtprbogomips        : 6006.73
processor        : 1vendor_id        : GenuineIntelcpu family        : 15model                : 4model name        : Intel(R) Xeon(TM) CPU 3.00GHzstepping        : 3cpu MHz                : 3000.881cache size        : 2048 KBphysical id        : 0siblings        : 2core id                : 0cpu cores        : 1fdiv_bug        : nohlt_bug                : nof00f_bug        : nocoma_bug        : nofpu                : yesfpu_exception        : yescpuid level        : 5wp                : yesflags                : 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 xtprbogomips        : 5999.40
processor        : 2vendor_id        : GenuineIntelcpu family        : 15model                : 4model name        : Intel(R) Xeon(TM) CPU 3.00GHzstepping        : 3cpu MHz                : 3000.881cache size        : 2048 KBphysical id        : 3siblings        : 2core id                : 3cpu cores        : 1fdiv_bug        : nohlt_bug                : nof00f_bug        : nocoma_bug        : nofpu                : yesfpu_exception        : yescpuid level        : 5wp                : yesflags                : 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 xtprbogomips        : 5999.08
processor        : 3vendor_id        : GenuineIntelcpu family        : 15model                : 4model name        : Intel(R) Xeon(TM) CPU 3.00GHzstepping        : 3cpu MHz                : 3000.881cache size        : 2048 KBphysical id        : 3siblings        : 2core id                : 3cpu cores        : 1fdiv_bug        : nohlt_bug                : nof00f_bug        : nocoma_bug        : nofpu                : yesfpu_exception        : yescpuid level        : 5wp                : yesflags                : 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 xtprbogomips        : 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型号,一般主机商不会用这么好的。
Instance:[dshang-sh@esisop63 processor]$ cat /proc/cpuinfo |grep physical |sort -u |wc -l 5
[dshang-sh@esisop63 processor]$ cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l4[dshang-sh@esisop63 processor]$ cat /proc/cpuinfo |grep "physical id"|sort -u|wc -l4
[dshang-sh@esisop63 processor]$ more /proc/cpuinfo|grep "physical id"|sortphysical id     : 0physical id     : 0physical id     : 0physical id     : 0physical id     : 0physical id     : 0physical id     : 1physical id     : 1physical id     : 1physical id     : 1physical id     : 1physical id     : 1physical id     : 2physical id     : 2physical id     : 2physical id     : 2physical id     : 2physical id     : 2physical id     : 3physical id     : 3physical id     : 3physical id     : 3physical id     : 3physical id     : 3