(1)pmap
NAME
pmap - report memory map of a process
SYNOPSIS
pmap [-x|-d] [-q] pid ...
pmap -V
(2)ps
UNIX95 = ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' 其中rsz是是实际内存
如:查看init的内存使用情况:
ps -aux | grep init
或者:ps -eo nice,pid,vsz,rss,cmd | grep init
可以看到:
- USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
-
root 1 0.0 0.0 1584 536 ? S s 10:43 0:00 init [3]
(3)top
top -d 1
然后shift + m(Sort by memory usage)
(4)/proc/$PID/cat status
Name: printall
State: R (running)
Tgid: 28036
Pid: 28036
PPid: 1
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 256
Groups: 0
VmPeak: 20932 kB
VmSize: 16208 kB
VmLck: 0 kB
VmHWM: 7940 kB
VmRSS: 3476 kB
VmData: 12032 kB
VmStk: 84 kB
VmExe: 48 kB
VmLib: 3920 kB
VmPTE: 28 kB
Threads: 2
SigQ: 0/24567
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000001001
SigCgt: 0000000180000000
CapInh: 0000000000000000
CapPrm: ffffffffffffffff
CapEff: ffffffffffffffff
CapBnd: ffffffffffffffff
Cpus_allowed: 00000000,0000000f
Cpus_allowed_list: 0-3
Mems_allowed: 1
Mems_allowed_list: 0
voluntary_ctxt_switches: 274346570
nonvoluntary_ctxt_switches: 171470
任务虚拟地址空间的大小 VmSize
应用程序正在使用的物理内存的大小 VmRSS
值得说明的ps aux中的VSZ RSS分别对应/proc/pid/status中的VmSize和VmRSS。
阅读(3202) | 评论(0) | 转发(0) |