linux /proc/cpuinfo文件分析
為什么80%的碼農(nóng)都做不了架構(gòu)師?>>> ??
基于不同指令集(ISA)的CPU產(chǎn)生的/proc/cpuinfo文件不一樣,基于X86指令集CPU的/proc/cpuinfo文件包含如下內(nèi)容:
processor : 0
vendor_id :GenuineIntel
cpu family :6
model :26
model name :Intel(R) Xeon(R) CPU?????????? E5520? @ 2.27GHz
stepping ? :5
cpu MHz ?:1600.000
cache size : 8192 KB
physical id :0
siblings :8
core id ? : 0
cpu cores :4
apicid ?????? :0
fpu ? :yes
fpu_exception :yes
cpuid level : 11
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 nx rdtscp lm constant_tsc ida nonstop_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr popcnt lahf_lm
bogomips :4522.12
clflush size :64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management :
以上輸出項(xiàng)的含義如下:
processor :系統(tǒng)中邏輯處理核的編號。對于單核處理器,則課認(rèn)為是其CPU編號,對于多核處理器則可以是物理核、或者使用超線程技術(shù)虛擬的邏輯核
vendor_id :CPU制造商 ?????
cpu family :CPU產(chǎn)品系列代號
model :CPU屬于其系列中的哪一代的代號
model name:CPU屬于的名字及其編號、標(biāo)稱主頻
stepping ? :CPU屬于制作更新版本
cpu MHz ? :CPU的實(shí)際使用主頻
cache size?? :CPU二級緩存大小
physical id?? :單個(gè)CPU的標(biāo)號
siblings?????? :單個(gè)CPU邏輯物理核數(shù)
core id??????? :當(dāng)前物理核在其所處CPU中的編號,這個(gè)編號不一定連續(xù)
cpu cores??? :該邏輯核所處CPU的物理核數(shù)
apicid????????? :用來區(qū)分不同邏輯核的編號,系統(tǒng)中每個(gè)邏輯核的此編號必然不同,此編號不一定連續(xù)
fpu???????????? :是否具有浮點(diǎn)運(yùn)算單元(Floating Point Unit)
fpu_exception? :是否支持浮點(diǎn)計(jì)算異常
cpuid level?? :執(zhí)行cpuid指令前,eax寄存器中的值,根據(jù)不同的值cpuid指令會(huì)返回不同的內(nèi)容
wp???????????? :表明當(dāng)前CPU是否在內(nèi)核態(tài)支持對用戶空間的寫保護(hù)(Write Protection)
flags????????? :當(dāng)前CPU支持的功能
bogomips?? :在系統(tǒng)內(nèi)核啟動(dòng)時(shí)粗略測算的CPU速度(Million Instructions Per Second)
clflush size? :每次刷新緩存的大小單位
cache_alignment :緩存地址對齊單位
address sizes? ?? :可訪問地址空間位數(shù)
power management :對能源管理的支持,有以下幾個(gè)可選支持功能:
ts: temperature sensor
fid: ? frequency id control
vid: voltage id control
ttp: thermal trip
tm:
stc:
100mhzsteps:
hwpstate:
CPU信息中flags各項(xiàng)含義:
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”
根據(jù)以上內(nèi)容,我們則可以很方便的知道當(dāng)前系統(tǒng)關(guān)于CPU、CPU的核數(shù)、CPU是否啟用超線程等信息。
查詢系統(tǒng)具有多少個(gè)邏輯核:cat /proc/cpuinfo | grep "processor" | wc -l
查詢系統(tǒng)CPU的物理核數(shù):cat /proc/cpuinfo | grep "cpu cores" | uniq
查詢系統(tǒng)CPU是否啟用超線程:cat /proc/cpuinfo | grep -e "cpu cores"? -e "siblings" | sort | uniq
輸出舉例:
cpu cores?? ?: 6
siblings?? ? : 6
如果cpu cores數(shù)量和siblings數(shù)量一致,則沒有啟用超線程,否則超線程被啟用。
查詢系統(tǒng)CPU的個(gè)數(shù):cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
查詢系統(tǒng)CPU是否支持某項(xiàng)功能,則根以上類似,輸出結(jié)果進(jìn)行sort, uniq和grep就可以得到結(jié)果。
轉(zhuǎn)載于:https://my.oschina.net/5lei/blog/189812
總結(jié)
以上是生活随笔為你收集整理的linux /proc/cpuinfo文件分析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一、OpenStack架构
- 下一篇: wcf会话、实例化、并发