在Linux系統中,提供了proc文件系統顯示系統的軟硬件信息。如果想了解系統中CPU的提供商和相關配置信息,則可以通過/proc/cpuinfo文件得到。我們來看看X86和ARM平臺下CPU信息的差異。
基于不同指令集(ISA)的CPU產生的/proc/cpuinfo文件不一樣,基于X86指令集CPU的/proc/cpuinfo文件包含如下內容:
processor
: 60
vendor_id
: GenuineIntel
cpu family
: 6
model
: 85
model name
: Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz
stepping
: 4
microcode
: 0x200005a
cpu MHz
: 2100.000
cache size
: 22528 KB
physical id
: 1
siblings
: 32
core id
: 12
cpu cores
: 16
apicid
: 57
initial apicid
: 57
fpu
: yes
fpu_exception
: yes
cpuid level
: 22
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 pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm arat pln pts pku ospke
bugs
:
bogomips
: 4206.91
clflush size
: 64
cache_alignment
: 64
address sizes
: 46 bits physical, 48 bits virtual
power management:
processor
: 61
vendor_id
: GenuineIntel
cpu family
: 6
model
: 85
model name
: Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz
stepping
: 4
microcode
: 0x200005a
cpu MHz
: 2100.000
cache size
: 22528 KB
physical id
: 1
siblings
: 32
core id
: 13
cpu cores
: 16
apicid
: 59
initial apicid
: 59
fpu
: yes
fpu_exception
: yes
cpuid level
: 22
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 pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm arat pln pts pku ospke
bugs
:
bogomips
: 4207.24
clflush size
: 64
cache_alignment
: 64
address sizes
: 46 bits physical, 48 bits virtual
power management:
processor
: 62
vendor_id
: GenuineIntel
cpu family
: 6
model
: 85
model name
: Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz
stepping
: 4
microcode
: 0x200005a
cpu MHz
: 2100.000
cache size
: 22528 KB
physical id
: 1
siblings
: 32
core id
: 14
cpu cores
: 16
apicid
: 61
initial apicid
: 61
fpu
: yes
fpu_exception
: yes
cpuid level
: 22
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 pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm arat pln pts pku ospke
bugs
:
bogomips
: 4206.63
clflush size
: 64
cache_alignment
: 64
address sizes
: 46 bits physical, 48 bits virtual
power management:
processor
: 63
vendor_id
: GenuineIntel
cpu family
: 6
model
: 85
model name
: Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz
stepping
: 4
microcode
: 0x200005a
cpu MHz
: 2100.000
cache size
: 22528 KB
physical id
: 1
siblings
: 32
core id
: 15
cpu cores
: 16
apicid
: 63
initial apicid
: 63
fpu
: yes
fpu_exception
: yes
cpuid level
: 22
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 pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm arat pln pts pku ospke
bugs
:
bogomips
: 4206.60
clflush size
: 64
cache_alignment
: 64
address sizes
: 46 bits physical, 48 bits virtual
power management:
看不懂?沒有關系,下面會詳細的歸納總結。
processor :系統中邏輯處理核的編號。對于單核處理器,則可認為是其CPU編號,對于多核處理器則可以是物理核、或者使用超線程技術虛擬的邏輯核
vendor_id :CPU制造商,這里是英特爾
cpu family :CPU產品家族代號
model :CPU型號代號
model name:CPU屬于的名字及其編號、標稱主頻
stepping :CPU的工藝步進編號
microcode : 處理器微代碼
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支持的功能
bogomips :在系統內核啟動時粗略測算的CPU速度(Million Instructions Per Second)
clflush size :每次刷新緩存的大小單位
cache_alignment :緩存地址對齊單位
address sizes :可訪問地址空間位數
power management :對電源管理的支持
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”
來看一下國產某平臺的/proc/cpuinfo 信息,注意是ARM64
processor
: 14
BogoMIPS
: 100.00
Features
: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer
: 0x70
CPU architecture: 8
CPU variant
: 0x1
CPU part
: 0x660
CPU revision
: 1
processor
: 15
BogoMIPS
: 100.00
Features
: fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer
: 0x70
CPU architecture: 8
CPU variant
: 0x1
CPU part
: 0x660
CPU revision
: 1
processor : 0 ~ processor : 15 表示 16 核 CPU
BogoMIPS : 100.00 [在系統內核啟動時粗略測算的CPU速度(Million Instructions Per Second)]
CPU implementer : [ARM 架構 cpu.h]
CPU architecture: 基于ARM公司開發的精簡指令集架構的指令集架構
CPU part : [ARM_CPU_PART_CORTEX_A53 架構 cputype.h]
CPU revision : [配置版本或者配置修正]<1 第一批 2 修訂版,改進版>
查看cpu型號
cat /proc/cpuinfo |grep name|cut -d ‘:’ -f 2|uniq -c
總核數 = 物理CPU個數 X 每顆物理CPU的核數
總邏輯CPU數 = 物理CPU個數 X 每顆物理CPU的核數 X 超線程數
查看物理CPU個數
cat /proc/cpuinfo| grep “physical id”| sort| uniq| wc -l
查看每個物理CPU中core的個數
cat /proc/cpuinfo| grep “cpu cores”| uniq
查看邏輯CPU的個數
cat /proc/cpuinfo| grep “processor”| wc -l
邏輯cpu數=物理CPU個數 × 每顆核數 × 超線程數
32 = 2 × 8 × ?
? = 2 說明cpu支持超線程。
超線程
它可使處理器中的1 顆內核(core)如2 顆(core)內核那樣在操作系統中發揮作用。這樣一來,操作系統可使用的執行資源擴大了一倍,大幅提高了系統的整體性能。
本站文章版權歸原作者及原出處所有 。內容為作者個人觀點, 并不代表本站贊同其觀點和對其真實性負責,本站只提供參考并不構成任何投資及應用建議。本站是一個個人學習交流的平臺,網站上部分文章為轉載,并不用于任何商業目的,我們已經盡可能的對作者和來源進行了通告,但是能力有限或疏忽,造成漏登,請及時聯系我們,我們將根據著作權人的要求,立即更正或者刪除有關內容。本站擁有對此聲明的最終解釋權。