在Linux系统中,如何详细了解CPU的信息呢? 当然是通过cat /proc/cpuinfo来检查了,但是比如几个物理CPU/几核/几线程,这些问题怎么确定呢?

经过查看,我的开发机器是1个物理CPU,4核8线程,Intel(R) Core(TM) i7 CPU 860  @ 2.80GHz
记录一下,判断的过程和知识。
 
[root@node02 ~]# cat /proc/cpuinfo
processor :
vendor_id : GenuineIntel
cpu family :
model :
model name : Intel(R) Xeon(R) CPU E5- v2 @ .10GHz
stepping :
microcode : 0x427
cpu MHz : 2100.000
cache size : KB
physical id :
siblings :
core id :
cpu cores :
apicid :
initial apicid :
fpu : yes
fpu_exception : yes
cpuid level :
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb pln pts dtherm
bogomips : 4200.00
clflush size :
cache_alignment :
address sizes : bits physical, bits virtual
power management: processor :
vendor_id : GenuineIntel
cpu family :
model :
model name : Intel(R) Xeon(R) CPU E5- v2 @ .10GHz
stepping :
microcode : 0x427
cpu MHz : 2100.000
cache size : KB
physical id :
siblings :
core id :
cpu cores :
apicid :
initial apicid :
fpu : yes
fpu_exception : yes
cpuid level :
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb pln pts dtherm
bogomips : 4200.00
clflush size :
cache_alignment :
address sizes : bits physical, bits virtual
power management: processor :
vendor_id : GenuineIntel
cpu family :
model :
model name : Intel(R) Xeon(R) CPU E5- v2 @ .10GHz
stepping :
microcode : 0x427
cpu MHz : 2100.000
cache size : KB
physical id :
siblings :
core id :
cpu cores :
apicid :
initial apicid :
fpu : yes
fpu_exception : yes
cpuid level :
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb pln pts dtherm
bogomips : 4200.00
clflush size :
cache_alignment :
address sizes : bits physical, bits virtual
power management: processor :
vendor_id : GenuineIntel
cpu family :
model :
model name : Intel(R) Xeon(R) CPU E5- v2 @ .10GHz
stepping :
microcode : 0x427
cpu MHz : 2100.000
cache size : KB
physical id :
siblings :
core id :
cpu cores :
apicid :
initial apicid :
fpu : yes
fpu_exception : yes
cpuid level :
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx hypervisor lahf_lm ida arat epb pln pts dtherm
bogomips : 4200.00
clflush size :
cache_alignment :
address sizes : bits physical, bits virtual
power management:
 
判断依据:
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.
 
echo "logical CPU number:"
#逻辑CPU个数
cat /proc/cpuinfo | grep "processor" | wc -l
 
echo "physical CPU number:"
#物理CPU个数:
cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l
 
echo "core number in a physical CPU:"
#每个物理CPU中Core的个数:
cat /proc/cpuinfo | grep "cpu cores" | uniq | awk -F: '{print $2}'
#查看core id的数量,即为所有物理CPU上的core的个数
cat /proc/cpuinfo | grep "core id" | uniq |  wc -l
 
#是否为超线程?
#如果有两个逻辑CPU具有相同的”core id”,那么超线程是打开的。或者siblings数目比cpu cores数目大。
#每个物理CPU中逻辑CPU(可能是core, threads或both)的个数:
cat /proc/cpuinfo | grep "siblings"
 
 
/proc/cpuinfo 文件包含系统上每个处理器的数据段落。/proc/cpuinfo 描述中有 6 个条目适用于多内核和超线程(HT)技术检查:processor, vendor id, physical id, siblings, core id 和 cpu cores。
processor 条目包括这一逻辑处理器的唯一标识符。
physical id 条目包括每个物理封装的唯一标识符。
core id 条目保存每个内核的唯一标识符。
siblings 条目列出了位于相同物理封装中的逻辑处理器的数量。
cpu cores 条目包含位于相同物理封装中的内核数量。
如果处理器为英特尔处理器,则 vendor id 条目中的字符串是 GenuineIntel。
 
1.拥有相同 physical id 的所有逻辑处理器共享同一个物理插座。每个 physical id 代表一个唯一的物理封装。
2.Siblings 表示位于这一物理封装上的逻辑处理器的数量。它们可能支持也可能不支持超线程(HT)技术。
3.每个 core id 均代表一个唯一的处理器内核。所有带有相同 core id 的逻辑处理器均位于同一个处理器内核上。
4.如果有一个以上逻辑处理器拥有相同的 core id 和 physical id,则说明系统支持超线程(HT)技术。
5.如果有两个或两个以上的逻辑处理器拥有相同的 physical id,但是 core id 不同,则说明这是一个多内核处理器。cpu cores 条目也可以表示是否支持多内核。
 
判断CPU是否64位,检查cpuinfo中的flags区段,看是否有lm标识。
Are the processors 64-bit?   
A 64-bit processor will have lm ("long mode") in the flags section of cpuinfo. A 32-bit processor will not.

本文出自 “icooke的博客” 博客,请务必保留此出处http://icooke.blog.51cto.com/4123148/75755

cpuinfo的更多相关文章

  1. 查看cpu的信息cat /proc/cpuinfo

    cat /proc/cpuinfo processor : vendor_id : GenuineIntel cpu family : model : model name : Intel(R) Co ...

  2. linux cpuInfo

    转自:http://blog.csdn.net/lgstudyvc/article/details/7889364   /proc/cpuinfo文件分析 在Linux系统中,提供了proc文件系统显 ...

  3. Understanding Linux /proc/cpuinfo

    http://www.richweb.com/cpu_info A hyperthreaded processor has the same number of function units as a ...

  4. [转]linux /proc/cpuinfo 文件分析

    在Linux系统中,提供了proc文件系统显示系统的软硬件信息.如果想了解系统中CPU的提供商和相关配置信息,则可以通过/proc/cpuinfo文件得到.本文章针对该文件进行简单的总结. 基于不同指 ...

  5. /proc/cpuinfo zz

    /proc/cpuinfo文件分析 在Linux系统中,提供了proc文件系统显示系统的软硬件信息.如果想了解系统中CPU的提供商和相关配置信息,则可以通过/proc/cpuinfo文件得到.本文章针 ...

  6. mypc--------------->lspci,lsusb,meminfo cpuinfo ioports filesystems interrupts mounts net partitions pagetypeinfo slabinfo timer_list uptime version zoneinfo 等配置信息

    [user@username home]$ lspci00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Contro ...

  7. /proc/cpuinfo

    /proc文件系统是一个伪文件系统,它只存在内存当中,而不占用外存空间. 它以文件系统的方式为访问系统内核数据的操作提供接口. 用户和应用程序可以通过 proc得到系统的信息,并可以改变内核的某些参数 ...

  8. Linux CPU数量判断,通过/proc/cpuinfo.

    Linux CPU数量判断,通过/proc/cpuinfo. 相同 physical id :决定一个物理处理器 如果“siblings”和“cpu cores”一致,则说明不支持超线程,或者超线程未 ...

  9. Linux cpuinfo 详解

     在Linux系统中,如何详细了解CPU的信息呢? 当然是通过cat /proc/cpuinfo来检查了,但是比如几个物理CPU/几核/几线程,这些问题怎么确定呢? 经过查看,我的开发机器是1个物理C ...

  10. linux cat /proc/cpuinfo

    #cat /proc/cpuinfo processor : 0 #逻辑处理器的唯一标识符 vendor_id : AuthenticAMD #CPU厂商ID信息,如果处理器为英特尔处理器,则vend ...

随机推荐

  1. p/Invoke工具

    开源的工具 下面这个链接来下载这个工具: http://download.microsoft.com/download/f/2/7/f279e71e-efb0-4155-873d-5554a06085 ...

  2. 第01章-欢迎学习VTK

    [译者:这个系列教程是以Kitware公司出版的<VTK User's Guide -11th edition>一书作的中文翻译(出版时间2010年,ISBN: 978-1-930934- ...

  3. 使用IAR编译STM8S 怎样生产烧录文件

      IAR编译后能够生成的烧录文件格式有4中,例如以下 第一种是Motorola,其生成文件和STVD生成烧录文件.s19格式一样的,即能够通用 另外一种是16进制,keil等等常都用到的. 第三种是 ...

  4. 提高ASP.NET页面载入速度的方法

    前言 本文是我对ASP.NET页面载入速度提高的一些做法,这些做法分为以下部分: 目录 1.采用 HTTP Module 控制页面的生命周期. 2.自定义Response.Filter得到输出流str ...

  5. git回滚分支版本到指定版本

    昨天提交代码时Eclipse凌乱了,本来拉了dev-20190201分支的,结果提交时竟然跑到dev分支了.为了把dev分支回滚,可以有两种方式:Eclipse和命令行. 先说简单的命令行方式,先用g ...

  6. panabit web认证界面个性化

    原理:利用js代码在前端页面进行个性化 1.禁止信息提示 url:http://192.168.0.246:8010/restrict.htm 文件:restrict.png  restrict.ht ...

  7. ANSI和UNICODE编程的注意事项

    建立UNICODE编码工程 在VC60下,默认方式下建立的是ANSI编码的工程(注:编译的exe内部,其资源字符是以UNICODE保存),建立UNICODE编码工程的方法: 1.为工程添加UNICOD ...

  8. 黄聪:V2010中C#实现友好的等待任务完成时,出现的多线程悬浮窗体

    实现效果如下: 项目已经打包后,大家直接下载吧:[HCWaitForm.rar]

  9. 【精华】部署与管理ZooKeeper(转)

    部署与管理ZooKeeper(转) 本文以ZooKeeper3.4.3版本的官方指南为基础:http://zookeeper.apache.org/doc/r3.4.3/zookeeperAdmin. ...

  10. CFGym 101158B(巨坑题)

    前言:无话可说,看懂题意就没什么难度了. 题意:对于[0, 9999]区间内的每一个数b,通过输入的转换表,得到一个e值,把这个值添加到b的后面,得到一个五位数c.对于c的每一位,从0枚举到9,得到5 ...