Sunday, July 11, 2010

linux proc/cpuinfo

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model          : 6
model name     : Intel(R) Pentium(R) 4 CPU 3.00GHz
stepping        : 5
cpu MHz        : 3143.295
cache size       : 0 KB
physical id       0
siblings         : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug       : no
fpu             : yes
fpu_exception    : yes
cpuid level      : 6
wp             : yes
flags           : fpu vme pse tsc msr pae cx8 sep pge cmov acpi mmx fxsr sse sse2
bogomips       : 1674.44

rpm i386 i586 i686 之间的区别

有的rpm有分i386 i586 i686等 不同版本,如:
  abc-1.2.3-4.i386.rpm
  abc-1.2.3-4.i586.rpm
  abc-1.2.3-4.i686.rpm
  它们有什么不同呢?

  这里的i386 i586 i686指的是适用于intel i386 i586i686 兼 容指令集的微处理器。一般来说,等级愈高的机器可接受较低等级的rpm文件。
i386
—几乎所有的X86平台,不论是旧的pentum或 者是新的pentum-IVK7系统CPU,都可以正常工作,i指得是Intel兼容的CPU,至于386就是CPU的等级。
i586—就是586等级的计算机, 包括pentum第一代MMX CPUAMDK5K6系 统CPUsocket7插脚)等CPU都是这个等级。
i686pentum 2 以后的Intel系统CPUK7以后等级的CPU都属于这个686等级。
你可以透过/proc/cpuinfo这个档案查询你的CPU等级。

/proc/cpuinfo

This virtual file identifies the type of processor used by your system. The following is an example of the output typical of /proc/cpuinfo:
         processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 2 model name : Intel(R) Xeon(TM) CPU 2.40GHz stepping : 7 cpu MHz : 2392.371 cache size : 512 KB physical id : 0 siblings : 2 runqueue : 0 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm bogomips : 4771.02 
      
·         processor Provides each processor with an identifying number. On systems that have one processor, only a 0 is present.
·         cpu family Austhoritatively identifies the type of processor in the system. For an Intel-based system, place the number in front of "86" to determine the value. This is particularly helpful for those attempting to identify the architecture of an older system such as a 586, 486, or 386. Because some RPM packages are compiled for each of these particular architectures, this value also helps users determine which packages to install.
·         model name Displays the common name of the processor, including its project name.
·         cpu MHz Shows the precise speed in megahertz for the processor to the thousandths decimal place.
·         cache size Displays the amount of level 2 memory cache available to the processor.
·         siblings Displays the number of sibling CPUs on the same physical CPU for architectures which use hyper-threading.
·         flags Defines a number of different qualities about the processor, such as the presence of a floating point unit (FPU) and the ability to process MMX instructions.

Understanding /proc/cpuinfo

Example:

$ uname -r
2.6.18-8.el5
How many physical processors are there?
grep 'physical id' /proc/cpuinfo | sort | uniq | wc -l
2
How many virtual processors are there?
$ grep ^processor /proc/cpuinfo | wc -l
4
Are the processors dual-core (or multi-core)?
$ grep 'cpu cores' /proc/cpuinfo
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2


"2" indicates the two physical processors are dual-core, resulting in 4 virtual processors.

If "1" was returned, the two physical processors are single-core. If the processors are single-core, and the number of virtual processors is greater than the number of physical processors, the CPUs are using hyper-threading. Hyper-threading is supported if
ht is present in the CPU flags and you are using an SMP kernel.
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.

e.g.,

flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm cr8legacy ts fid vid ttp tm stc
What do the CPU flags mean?
The CPU flags are briefly described in the kernel header file cpufeature.h.

proc/cpuinfo 确定系统的CPU情况



一些操作系统的最新版本已经更新了 /proc/cpuinfo 文件,以支持多路平台。如果您的系统中的 /proc/cpuinfo 文件能够正确地反映出处理器信息,那么就不需要执行上述步骤。反之,可采用本文中的信息进行解释。
/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。

拥有相同 physical id 的所有逻辑处理器共享同一个物理插座。每个 physical id 代表一个唯一的物理封装。Siblings 表示位于这一物理封装上的逻辑处理器的数量。它们可能支持也可能不支持超线程(HT)技术。每个 core id 均代表一个唯一的处理器内核。所有带有相同 core id 的逻辑处理器均位于同一个处理器内核上。如果有一个以上逻辑处理器拥有相同的 core id 和 physical id,则说明系统支持超线程(HT)技术。如果有两个或两个以上的逻辑处理器拥有相同的 physical id,但是 core id 不同,则说明这是一个多内核处理器。cpu cores 条目也可以表示是否支持多内核。
例如,如果系统包含两个物理封装,每个封装中又包含两个支持超线程(HT)技术的处理器内核,则 /proc/cpuinfo 文件将包含此数据。(注:数据并不在表格中。)



 processor
 0
 1
 2
 3
 4
 5
 6
 7
 physical id
 0
 1
 0
 1
 0
 1
 0
 1
 core id
 0
2
1
 3
 0
 2
 1
 3
 siblings
 4
 4
 4
 4
 4
 4
 4
 4
 cpu cores
 2
 2
 2
 2
 2
 2
 2
 2


此例说明逻辑处理器 0 和 4 驻留在物理封装 0 的内核 0 上。这就表示逻辑处理器 0 和 4 支持超线程(HT)技术。相同的工作可用于封装 0 内核 1 上的逻辑处理器 2 和 6,封装 1 内核 2 上的逻辑处理器 1 和 5,以及封装 1 内核 3 上的逻辑处理器 3 和 7。此系统支持超线程(HT)技术,因为两个逻辑处理器共享同一个内核。有两种方式可以确定是否支持多内核。由于内核 0 和 1 存在于封装 0 上,而内核 2 和 3 存在于封装 1 上,所以这是一个多内核系统。此外,cpu cores 条目为 2,也说明有两个内核驻留在物理封装中。这是一个多路系统,因为有两个封装。
值得注意的是 physical id 和 core id 的编号可能是也可能不是连续的。系统上有两个物理封装并不罕见,而且 physical id 等于 0 和 3
CPU ID
CPU ID是CPU生产厂家为识别不同类型的CPU,而为CPU制订的不同的单一的代码;不同厂家的CPU,其CPU ID定义也是不同的;如 “0F24”(Inter处理器)、“681H”(AMD处理器),根据这些数字代码即可判断CPU属于哪种类型,这就是一般意义上的CPU ID。
由 于计算机使用的是十六进制,因此CPU ID也是以十六进制表示的。Inter处理器的CPU ID一共包含四个数字,如“0F24”,从左至右分别表示 Type(类型)、Family(系列)、Mode(型号)和Stepping(步进编号)。从CPUID为“068X”的处理器开始,Inter另外增 加了Brand ID(品种标识)用来辅助应用程序识别CPU的类型,因此根据“068X”CPUID还不能正确判别Pentium和Celerom处理 器。必须配合Brand ID来进行细分。AMD处理器一般分为三位,如“681”,从左至右分别表示为Family(系列)、Mode(型号)和 Stepping(步进编号)。
Type(类型)
类型标识用来区别INTEL微处理器是用于由最终用户安装,还是由专业个人计算机系 统集成商、服务公司或制作商安装;数字“1”标识所测试的微处理器是用于由用户安装的;数字“0”标识所测试的微处理器是用于由专业个人计算机系统集成 商、服务公司或制作商安装的。我们通常使用的INTEL处理器类型标识都是“0”,“0F24”CPUID就属于这种类型。
Family(系列)
系 列标识可用来确定处理器属于那一代产品。如6系列的INTEL处理器包括Pentium Pro、Pentium II、 Pentium II Xeon、Pentium III和Pentium III Xeon处理器。5系列(第五代)包括Pentium处理器和采用 MMX技术的Pentium处理器。AMD的6系列实际指有K7系列CPU,有DURON和ATHION两大类。最新一代的 INTEL Pentium 4系列处理器(包括相同核心的Celerom处理器)的系列值为“F”
Mode(型号)
型号标识可用来 确定处理器的制作技术以及属于该系列的第几代设计(或核心),型号与系列通常是相互配合使用的,用于确定计算机所安装的处理器是属于某系列处理器的哪种特 定类型。如可确定Celerom处理器是Coppermine还是Tualutin核心;Athlon XP处理器是Paiomino还是 Thorouhgbred核心。
Stepping(步进编号)
步进编号用来标识处理器的设计或制作版本,有助于控制和跟踪处理器的更 改,步进还可以让最终用户更具体地识别其系统安装的处理器版本,确定微处理器的内部设计或制作特性。步进编号就好比处理器的小版本号,如CPUID为 “686”和“686A”就好比WINZIP8.0和8.1的关系。步进编号和核心步进是密切联系的。如CPUID为“686”的Pentium III 处理器是cCO核心,而“686A”表示的是更新版本cD0核心。
Brand ID(品种标识)
INTEL从Coppermine核心 的处理器开始引入Brand ID作为CPU的辅助识别手段。如我们通过Brand ID可以识别出处理器究竟是Celerom还是Pentium 4。