您的位置:首页 > 运维架构 > Linux

Linux查看物理CPU个数、核数、逻辑CPU个数

2014-12-11 11:17 330 查看
判断依据:

1.具有相同physical id和core id的cpu是同一个core的超线程(processor不同)。

2.具有相同core id的cpu是同一颗cpu封装的超线程。

英文版:

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.

查看当前操作系统内核信息

# uname -a

Linux SV0-15 2.6.18-238.1.1.el5 #1 SMP Tue Jan 25 23:46:15 CST 2011 x86_64 x86_64 x86_64 GNU/Linux

查看当前操作系统发行版信息

#cat /etc/issue

Red Hat Enterprise Linux Server release 5.5 (Tikanga)

查看cpu型号

# cat /proc/cpuinfo | grep 'model name' | cut -f2 -d: | uniq -c

      8  Intel(R) Xeon(R) CPU           E5606  @ 2.13GHz

(看到有8个逻辑CPU, 也知道了CPU型号)

查看物理CPU个数

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

2

# cat /proc/cpuinfo| grep "physical id"

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

是2个物理cpu,每个都是4核的

查看物理CPU中core的个数(即核数)

# grep 'core id' /proc/cpuinfo | sort -u | wc -l

4

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

cpu cores       : 4

查看逻辑CPU的个数(线程数和核数一致,没有开启hyperthreads)

# grep 'processor' /proc/cpuinfo | sort -u | wc -l

8

# grep 'processor' /proc/cpuinfo | sort -u       

processor       : 0

processor       : 1

processor       : 2

processor       : 3

processor       : 4

processor       : 5

processor       : 6

processor       : 7

查看cpu运行模式

# getconf LONG_BIT

64

查看cpu是否支持64bit

# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l

8

(结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit)

cpu详细信息:

# cat /proc/cpuinfo

转载源: http://blog.csdn.net/cbmsft/article/details/7219370
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux cpu