[轉]linux /proc/cpuinfo 文件分析

在Linux系統中,提供了proc文件系統顯示系統的軟硬件信息。若是想了解系統中CPU的提供商和相關配置信息,則能夠經過/proc/cpuinfo文件獲得。本文章針對該文件進行簡單的總結。api

基於不一樣指令集(ISA)的CPU產生的/proc/cpuinfo文件不同,基於X86指令集CPU的/proc/cpuinfo文件包含以下內容:緩存

# cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 45
model name      : Intel(R) Xeon(R) CPU E5-2609 0 @ 2.40GHz
stepping        : 7
cpu MHz         : 2400.000
cache size      : 10240 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
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 arat epb xsaveopt pln pts dts
bogomips        : 4800.00
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

以上輸出項的含義以下:oop

processorui

系統中邏輯處理核的編號。對於單核處理器,則課認爲是其CPU編號,對於多核處理器則能夠是物理核、或者使用超線程技術虛擬的邏輯核spa

vendor_id線程

CPU製造商code

cpu familyblog

 CPU產品系列代號

model排序

 CPU屬於其系列中的哪一代的代號

model nameip

 CPU屬於的名字及其編號、標稱主頻

stepping

 CPU屬於製做更新版本

cpu MHz

 CPU的實際使用主頻

cache size

 CPU二級緩存大小

physical id

 單個CPU的標號

siblings

 單個CPU邏輯物理核數

core id

 當前物理核在其所處CPU中的編號,這個編號不必定連續

cpu cores

 該邏輯核所處CPU的物理核數

apicid

 用來區分不一樣邏輯核的編號,系統中每一個邏輯核的此編號必然不一樣,此編號不必定連續

fpu

 是否具備浮點運算單元(Floating Point Unit)

fpu_exception

 是否支持浮點計算異常

cpuid level

 執行cpuid指令前,eax寄存器中的值,根據不一樣的值cpuid指令會返回不一樣的內容

wp

 代表當前CPU是否在內核態支持對用戶空間的寫保護(Write Protection)

flags

當前CPU支持的功能,CUP信息中flags各項含義

fpu: Onboard (x87) Floating Point Unit

vme: Virtual Mode Extension

de: Debugging Extensions

pse: Page Size Extensions

tsc: Time Stamp Counter: support for RDTSC and WRTSC instructions

msr: Model-Specific Registers

pae: Physical Address Extensions: ability to access 64GB of memory; only 4GB can be accessed at a time though

mce: Machine Check Architecture

cx8: CMPXCHG8 instruction

apic: Onboard Advanced Programmable Interrupt Controller

sep: Sysenter/Sysexit Instructions; SYSENTER is used for jumps to kernel memory during system calls, and SYSEXIT is used for jumps: back to the user code

mtrr: Memory Type Range Registers

pge: Page Global Enable

mca: Machine Check Architecture

cmov: CMOV instruction

pat: Page Attribute Table

pse36: 36-bit Page Size Extensions: allows to map 4 MB pages into the first 64GB RAM, used with PSE.

pn: Processor Serial-Number; only available on Pentium 3

clflush: CLFLUSH instruction

dtes: Debug Trace Store

acpi: ACPI via MSR

mmx: MultiMedia Extension

fxsr: FXSAVE and FXSTOR instructions

sse: Streaming SIMD Extensions. Single instruction multiple data. Lets you do a bunch of the same operation on different pieces of input: in a single clock tick.

sse2: Streaming SIMD Extensions-2. More of the same.

selfsnoop: CPU self snoop

acc: Automatic Clock Control

IA64: IA-64 processor Itanium.

ht: HyperThreading. Introduces an imaginary second processor that doesn’t do much but lets you run threads in the same process a  bit quicker.

nx: No Execute bit. Prevents arbitrary code running via buffer overflows.

pni: Prescott New Instructions aka. SSE3

vmx: Intel Vanderpool hardware virtualization technology

svm: AMD 「Pacifica」 hardware virtualization technology

lm: 「Long Mode,」 which means the chip supports the AMD64 instruction set

tm: 「Thermal Monitor」 Thermal throttling with IDLE instructions. Usually hardware controlled in response to CPU temperature.

tm2: 「Thermal Monitor 2″ Decrease speed by reducing multipler and vcore.

est: 「Enhanced SpeedStep」

bogomips

 在系統內核啓動時粗略測算的CPU速度(Million Instructions Per Second)

clflush size

 每次刷新緩存的大小單位

cache_alignment

 緩存地址對齊單位

address sizes

 可訪問地址空間位數

power management

 對能源管理的支持,有如下幾個可選支持功能:

  ts:  temperature sensor

  fid:   frequency id control

  vid:  voltage id control

  ttp:  thermal trip

  tm:

  stc:

  100mhzsteps:

  hwpstate:

根據以上內容,咱們則能夠很方便的知道當前系統關於CPU、CPU的核數、CPU是否啓用超線程等信息。

例1:查詢系統具備多少個邏輯核

# cat /proc/cpuinfo | grep 'processor' | wc -l
4

說明:processor表示系統中邏輯覈編號,wc -l統計行數,由此獲得邏輯核個數

例2:查詢系統CPU的物理核數

# cat /proc/cpuinfo | grep 'cpu cores' | uniq
cpu cores       : 2

說明:cpu cores表示邏輯核所處cpu的物理核數目,uniq表示去重,由此獲得一個cup物理核的數目

例3:查詢系統CPU是否啓用超線程

DEV:/home/mak_sn> cat /proc/cpuinfo | grep -e 'cpu cores'  -e 'siblings' | sort | uniq
cpu cores       : 2
siblings        : 2

說明:

1.若是cpu cores數量和siblings數量一致,則沒有啓用超線程,不然超線程被啓用。

2.cup cores表示cpu物理核,siblings表示邏輯物理核,grep -e表示多個條件或,選出來的結果先sort排序,而後uniq去重。

例4:查詢系統CPU的個數

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

說明:physical id表示單個cpu的標號,排序去重,而後統計行數,獲得系統cpu的個數。

查詢系統CPU是否支持某項功能,則根以上相似,輸出結果進行sort, uniq和grep就能夠獲得結果。

 

【/proc/cpuinfo內容舉例】

1,Intel(R) Xeon(R) X5355
processor  : 0
vendor_id  : GenuineIntel
cpu famil  : 6
model     : 15
model name  : Intel(R) Xeon(R) CPU           X5355  @ 2.66GHz
stepping   : 7
cpu MHz   : 2666.766
cache size : 4096 KB
physical id : 0
siblings   : 4
core id    : 0
cpu cores  : 4
fpu      : yes
fpu_exception  : yes
cpuid level   : 10
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 syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips    : 5338.26
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor    : 1
vendor_id    : GenuineIntel
cpu family    : 6
model        : 15
model name    : Intel(R) Xeon(R) CPU           X5355  @ 2.66GHz
stepping    : 7
cpu MHz        : 2666.766
cache size    : 4096 KB
physical id    : 1
siblings    : 4
core id        : 0
cpu cores    : 4
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
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 syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips    : 5333.75
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 2
vendor_id    : GenuineIntel
cpu family    : 6
model        : 15
model name    : Intel(R) Xeon(R) CPU           X5355  @ 2.66GHz
stepping    : 7
cpu MHz        : 2666.766
cache size    : 4096 KB
physical id    : 0
siblings    : 4
core id        : 2
cpu cores    : 4
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
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 syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips    : 5333.67
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 3
vendor_id    : GenuineIntel
cpu family    : 6
model        : 15
model name    : Intel(R) Xeon(R) CPU           X5355  @ 2.66GHz
stepping    : 7
cpu MHz        : 2666.766
cache size    : 4096 KB
physical id    : 1
siblings    : 4
core id        : 2
cpu cores    : 4
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
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 syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips    : 5333.68
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 4
vendor_id    : GenuineIntel
cpu family    : 6
model        : 15
model name    : Intel(R) Xeon(R) CPU           X5355  @ 2.66GHz
stepping    : 7
cpu MHz        : 2666.766
cache size    : 4096 KB
physical id    : 0
siblings    : 4
core id        : 1
cpu cores    : 4
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
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 syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips    : 5333.67
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 5
vendor_id    : GenuineIntel
cpu family    : 6
model        : 15
model name    : Intel(R) Xeon(R) CPU           X5355  @ 2.66GHz
stepping    : 7
cpu MHz        : 2666.766
cache size    : 4096 KB
physical id    : 1
siblings    : 4
core id        : 1
cpu cores    : 4
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
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 syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips    : 5333.68
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 6
vendor_id    : GenuineIntel
cpu family    : 6
model        : 15
model name    : Intel(R) Xeon(R) CPU           X5355  @ 2.66GHz
stepping    : 7
cpu MHz        : 2666.766
cache size    : 4096 KB
physical id    : 0
siblings    : 4
core id        : 3
cpu cores    : 4
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
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 syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips    : 5333.69
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 7
vendor_id    : GenuineIntel
cpu family    : 6
model        : 15
model name    : Intel(R) Xeon(R) CPU           X5355  @ 2.66GHz
stepping    : 7
cpu MHz        : 2666.766
cache size    : 4096 KB
physical id    : 1
siblings    : 4
core id        : 3
cpu cores    : 4
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
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 syscall lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr dca lahf_lm
bogomips    : 5333.68
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:
2, Intel(R) Core(TM) i7 930 @ 2.80GHz
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 26
model name    : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
stepping    : 5
cpu MHz        : 2807.024
cache size    : 8192 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 11
wp        : yes
flags        : fpu de tsc msr pae mce cx8 apic sep mtrr mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nonstop_tsc aperfmperf pni est ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm ida
bogomips    : 5614.04
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 1
vendor_id    : GenuineIntel
cpu family    : 6
model        : 26
model name    : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
stepping    : 5
cpu MHz        : 2807.024
cache size    : 8192 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 11
wp        : yes
flags        : fpu de tsc msr pae mce cx8 apic sep mtrr mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nonstop_tsc aperfmperf pni est ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm ida
bogomips    : 5614.04
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 2
vendor_id    : GenuineIntel
cpu family    : 6
model        : 26
model name    : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
stepping    : 5
cpu MHz        : 2807.024
cache size    : 8192 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 11
wp        : yes
flags        : fpu de tsc msr pae mce cx8 apic sep mtrr mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nonstop_tsc aperfmperf pni est ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm ida
bogomips    : 5614.04
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 3
vendor_id    : GenuineIntel
cpu family    : 6
model        : 26
model name    : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
stepping    : 5
cpu MHz        : 2807.024
cache size    : 8192 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 11
wp        : yes
flags        : fpu de tsc msr pae mce cx8 apic sep mtrr mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nonstop_tsc aperfmperf pni est ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm ida
bogomips    : 5614.04
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 4
vendor_id    : GenuineIntel
cpu family    : 6
model        : 26
model name    : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
stepping    : 5
cpu MHz        : 2807.024
cache size    : 8192 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 11
wp        : yes
flags        : fpu de tsc msr pae mce cx8 apic sep mtrr mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nonstop_tsc aperfmperf pni est ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm ida
bogomips    : 5614.04
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 5
vendor_id    : GenuineIntel
cpu family    : 6
model        : 26
model name    : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
stepping    : 5
cpu MHz        : 2807.024
cache size    : 8192 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 11
wp        : yes
flags        : fpu de tsc msr pae mce cx8 apic sep mtrr mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nonstop_tsc aperfmperf pni est ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm ida
bogomips    : 5614.04
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 6
vendor_id    : GenuineIntel
cpu family    : 6
model        : 26
model name    : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
stepping    : 5
cpu MHz        : 2807.024
cache size    : 8192 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 11
wp        : yes
flags        : fpu de tsc msr pae mce cx8 apic sep mtrr mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nonstop_tsc aperfmperf pni est ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm ida
bogomips    : 5614.04
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:

processor    : 7
vendor_id    : GenuineIntel
cpu family    : 6
model        : 26
model name    : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
stepping    : 5
cpu MHz        : 2807.024
cache size    : 8192 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 11
wp        : yes
flags        : fpu de tsc msr pae mce cx8 apic sep mtrr mca cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nonstop_tsc aperfmperf pni est ssse3 cx16 sse4_1 sse4_2 popcnt hypervisor lahf_lm ida
bogomips    : 5614.04
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
power management:
相關文章
相關標籤/搜索