1. 通過 cat /proc/cpuinfo查看
類型一:包含了physical id、siblings、cpu id、cpu cores信息,processor表示邏輯處理器的個數,physical 表示物理處理器的個數
#cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Xeon(R) CPU L5410 @ 2.33GHz
stepping : 10
cpu MHz : 2003.000
cache size : 6144 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
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 aperfmperf pni est ssse3 cx16 sse4_1 hypervisor lahf_lm
bogomips : 4657.10
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
類型二: 沒有包含phpsical id、siblings、cpu id、cpu cores信息,此時processor就表示物理cpu的個數
#cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
stepping : 2
cpu MHz : 2394.094
cache size : 12288 KB
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu de tsc msr pae cx8 apic sep cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm ida arat
bogomips : 4790.55
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
各選項的含義:
processor :系統中邏輯處理器的編號。對於單核處理器,則認爲是其CPU編號,對於多核處理器則可以是物理核、或者使用超線程技術虛擬的邏輯核
vendor_id :CPU製造商
cpu family :CPU產品系列代號
model :CPU屬於其系列中的哪一代的代號
model name :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支持的功能
bogomips :在系統內核啓動時粗略測算的CPU速度(Million Instructions Per Second)
clflush size :每次刷新緩存的大小單位
cache_alignment :緩存地址對齊單位
address sizes :可訪問地址空間位數
power management :對能源管理的支持,有以下幾個可選支持功能:
vendor_id :CPU製造商
cpu family :CPU產品系列代號
model :CPU屬於其系列中的哪一代的代號
model name :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支持的功能
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信息中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”
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”
查看邏輯CPU個數:
# cat /proc/cpuinfo | grep 'processor' | wc -l
# cat /proc/cpuinfo | grep 'processor' | wc -l
查看物理CPU個數:
# cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l
# cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l
查看每個物理CPU中Core的個數:
# cat /proc/cpuinfo | grep 'cpu cores' | wc –l
# cat /proc/cpuinfo | grep 'cpu cores' | wc –l
二、通過lscpu命令查看(suse系統,沒這命令的跳過)
#lscpu
Architecture: x86_64
CPU(s): 8
Thread(s) per core: 1
Core(s) per socket: 1
CPU socket(s): 8
Vendor ID: GenuineIntel
CPU family: 6
Model: 23
Stepping: 10
CPU MHz: 2003.000
Hypervisor vendor: Xen
Virtualization type: none
L1d cache: 32K
L1i cache: 32K
L2 cache: 6144
三、通過top命令查看
#top
然後按數字1,既可以查看cpu的個數,還可以知道每個cpu的具體使用情況
Tasks: 76 total, 1 running, 75 sleeping, 0 stopped, 0 zombie
Cpu0 : 0.0%us, 0.3%sy, 0.0%ni, 94.4%id, 5.3%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu1 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 4207280k total, 724144k used, 3483136k free, 211508k buffers
Swap: 8385888k total, 0k used, 8385888k free, 330340k cached