登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

SeaRiver Blog

实力才是你一生最好的依靠!

 
 
 

日志

 
 

如何用Linux的命令正确识别cpu的个数和核数  

2010-08-19 17:02:02|  分类: Linux |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
如何在Linux下cpu的个数和核数呢?googel了一下,网上总结的很多办法都是错的或者混淆视听,没办法,靠自己了。

判断依据:

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.

以自己的惠普DL380G6为例说明:

①物理cpu个数:
[root@localhost ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
2
②每个物理cpu中core的个数(即核数)
[root@localhost ~]# cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores : 4
③每个物理cpu中逻辑cpu(可能是core、threads或both)的个数
[root@localhost ~]# cat /proc/cpuinfo | grep "siblings" | uniq
siblings : 8

# cat /proc/cpuinfo | grep "core"
core id     : 0
cpu cores    : 4
core id     : 0
cpu cores    : 4
core id     : 2
cpu cores    : 4
core id     : 2
cpu cores    : 4
core id     : 1
cpu cores    : 4
core id     : 1
cpu cores    : 4
core id     : 3
cpu cores    : 4
core id     : 3
cpu cores    : 4
core id     : 0
cpu cores    : 4
core id     : 0
cpu cores    : 4
core id     : 2
cpu cores    : 4
core id     : 2
cpu cores    : 4
core id     : 1
cpu cores    : 4
core id     : 1
cpu cores    : 4
core id     : 3
cpu cores    : 4
core id     : 3
cpu cores    : 4

※这款服务器的cpu蛮强悍的,难怪在许多linux命令中,如iostat中显示有16个cpu之多,这里也请大家注意区分物理cpu和逻辑cpu的区别,不要混淆了。最后能过查询服务器清单发现此款服务器用的cpu是英特尔至强E5540@2.53GHz,四核(Gainestown),二级缓存8MB,正好通过结果验证以上命令。
  评论这张
 
阅读(1071)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018