日期:2014-05-16  浏览次数:20634 次

查看linux内存、cpu

1.查看cpu数

多核cpu,包括物理多核和逻辑多核,一台机器可能有多个cpu,每个cpu可能有多核的,多个可能包括物理多核和逻辑多核。

/proc/cpuinfo 文件里记录了这些信息,以下是一个核的信息:

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : QEMU Virtual CPU version (cpu64-rhel6)
stepping        : 3
cpu MHz         : 2299.998
cache size      : 4096 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 4
wp              : yes
flags           : fpu de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm pni cx16 lahf_lm
bogomips        : 4599.31
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:


统计cpu数:grep 'physical id' /proc/cpuinfo | sort | uniq | wc -l

统计总核:cat /proc/cpuinfo |grep 'processor'|wc -l

统计物理核:grep "cpu cores" /proc/cpuinfo


?2.查看内存

(1)cat /proc/meminfo
(2)free 参数 -g -m 等表示单位为G,M
(3)top

3.查看系统位数

getconf LONG_BIT