自、管
分类: LINUX
2012-04-06 15:13:54
例如:
1.查看pmap如何使用:
[root@CentOS5 ~]# man pmap
PMAP(1) Linux User’s Manual PMAP(1)
NAME
pmap - report memory map of a process
SYNOPSIS
pmap [ -x | -d ] [ -q ] pids...
pmap -V
DESCRIPTION
The pmap command reports the memory map of a process or processes.
GENERAL OPTIONS
-x extended Show the extended format.
-d device Show the device format.
-q quiet Do not display some header/footer lines.
-V show version Displays version of program.
SEE ALSO
ps(1) pgrep(1)
STANDARDS
No standards apply, but pmap looks an awful lot like a SunOS command.
AUTHOR
Albert Cahalan <> wrote pmap in 2002, and is the cur-
rent maintainer of the procps collection. Please send bug reports to
<>.
Linux October 26, 2002 PMAP(1)
(END)
2.参数说明:
-x extended Show the extended format.
-d device Show the device format.
-q quiet Do not display some header/footer lines.
-V show version Displays version of program.
3.举例:
查看系统进程:
[isoa@InfoM188 ~]$ ps -ef|grep lighttpd
isoa 18579 1 0 15:33 ? 00:00:00 lighttpd -f /etc/lighttpd/lighttpd.conf
[isoa@InfoM188 ~]$ pmap -d 18579
18579: lighttpd -f /etc/lighttpd/lighttpd.conf
Address Kbytes Mode Offset Device Mapping
0000000000400000 164 r-x-- 0000000000000000 0fd:00000 lighttpd
0000000000629000 4 rw--- 0000000000029000 0fd:00000 lighttpd
0000000003c8f000 264 rw--- 0000000003c8f000 000:00000 [ anon ]
00000038ac400000 112 r-x-- 0000000000000000 0fd:00000 ld-2.5.so
00000038ac61b000 4 r---- 000000000001b000 0fd:00000 ld-2.5.so
00000038ac61c000 4 rw--- 000000000001c000 0fd:00000 ld-2.5.so
00000038ac800000 1336 r-x-- 0000000000000000 0fd:00000 libc-2.5.so
00000038ac94e000 2048 ----- 000000000014e000 0fd:00000 libc-2.5.so
00000038acb4e000 16 r---- 000000000014e000 0fd:00000 libc-2.5.so
00000038acb52000 4 rw--- 0000000000152000 0fd:00000 libc-2.5.so
00000038acb53000 20 rw--- 00000038acb53000 000:00000 [ anon ]
00000038ad000000 8 r-x-- 0000000000000000 0fd:00000 libdl-2.5.so
00000038ad002000 2048 ----- 0000000000002000 0fd:00000 libdl-2.5.so
00000038ad202000 4 r---- 0000000000002000 0fd:00000 libdl-2.5.so
00000038ad203000 4 rw--- 0000000000003000 0fd:00000 libdl-2.5.so
00002b06ab900000 4 rw--- 00002b06ab900000 000:00000 [ anon ]
00002b06ab92b000 12 rw--- 00002b06ab92b000 000:00000 [ anon ]
00002b06ab92e000 8 r-x-- 0000000000000000 0fd:00000 mod_indexfile.so
00002b06ab930000 2044 ----- 0000000000002000 0fd:00000 mod_indexfile.so
00002b06abb2f000 4 rw--- 0000000000001000 0fd:00000 mod_indexfile.so
00002b06abb30000 4 r-x-- 0000000000000000 0fd:00000 mod_access.so
00002b06abb31000 2048 ----- 0000000000001000 0fd:00000 mod_access.so
00002b06abd31000 4 rw--- 0000000000001000 0fd:00000 mod_access.so
00002b06abd32000 12 r-x-- 0000000000000000 0fd:00000 mod_accesslog.so
00002b06abd35000 2048 ----- 0000000000003000 0fd:00000 mod_accesslog.so
00002b06abf35000 4 rw--- 0000000000003000 0fd:00000 mod_accesslog.so
00002b06abf36000 16 r-x-- 0000000000000000 0fd:00000 mod_dirlisting.so
00002b06abf3a000 2044 ----- 0000000000004000 0fd:00000 mod_dirlisting.so
00002b06ac139000 4 rw--- 0000000000003000 0fd:00000 mod_dirlisting.so
00002b06ac13a000 12 r-x-- 0000000000000000 0fd:00000 mod_staticfile.so
00002b06ac13d000 2044 ----- 0000000000003000 0fd:00000 mod_staticfile.so
00002b06ac33c000 4 rw--- 0000000000002000 0fd:00000 mod_staticfile.so
00007fff9a733000 84 rw--- 00007ffffffea000 000:00000 [ stack ]
ffffffffff600000 8192 ----- 0000000000000000 000:00000 [ anon ]
mapped: 24632K writeable/private: 420K shared: 0K
每列的含义如下:
参数 解释
Address:进程所占的地址空间
Kbytes:该虚拟段的大小
RSS:设备号(主设备:次设备)
Anon:设备的节点号,0表示没有节点与内存相对应
Locked:是否允许swapped
Mode 权限:r=read, w=write, x=execute, s=shared, p=private(copy on write)
Mapping:bash 对应的映像文件名
Resident :表示在内存中驻留的段的空间
shared :表示这些北分配的内存是被系统中其他进程共享的。
private :表示只能被该进程使用的空间大小。你可以发现share的空间不具有 private的属性。
Prstat -LP 的输出的意义是:
size:就是该进程占用的地址空间。
RSS:实际被分配的内存的大小。
你看到的resident和RSS不同,是RSS是进程在内存中的实际的大小,这个数值最大可以达到Resident显示数值