Http://www.cnblogs.com/tibetanmastiff/archive/2011/10/10/2205799.html
Scenario:
According to Apache's working method, the pmap command is used to determine the memory usage details of an httpd process:
For example:
1. view how to use 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
AlbertCahalan<Albert@users.sf.net> wrote pmap in 2002, and
Is the cur-
Rent Maintainer of the procpsCollection.PleaseSendBugReportsTo
<Procps-feedback@lists.sf.net>.
Linux October 26,200 2 Pmap (1)
(End)
2. parameter description:
-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. Example:
View system processes:
[Root @ centos5 ~] # Ps aux
User PID % CPU % mem Vsz RSS tty Stat start Time
Command
Root 10.00.0 2072 616? SS May17 0: 01
Init [3]
(Omitted in the middle)
Daemon 96390.00.1211648484? S 0: 00
/Usr/local/apache2/bin/httpd
(The following section is omitted)
[Root @ centos5 ~] # Pmap-D 9639
9639: /Usr/local/apache2/bin/httpd-K start
Address Kbytes ModeOffset Device Mapping
00110000 28 R-X -- 0000000000000000 008:00003 librt-2.5.so
00117000 4 R ---- 0000000000006000 librt-2.5.so
00118000 4 RW --- 0000000000007000 librt-2.5.so
00119000 1276 R-X -- 0000000000000000 008:00003 libc-2.5.so
00258000 8 R ---- 000000000013f000 008:00003 libc-2.5.so
0025a000 4 RW --- 0000000000141000 libc-2.5.so
0025b000 12 RW --- 000000000025b000 000:00000 [Anon]
0025e000 60 r-X -- 0000000000000000 008:00003 libexslt. so.0.8.12
0026d000 4 RW --- zookeeper e000 008:00003 libexslt. so.0.8.12
0026e000 268 R-X -- 0000000000000000 008:00003 libmysqlclient. so.16.0.0
002b1000 168 RW --- 0000000000042000 008:00003 libmysqlclient. so.16.0.0
002db000 4 RW --- 00000000002db000 000:00000 [Anon]
002dc000 448 R-X -- 0000000000000000 008:00003 libfreetype. so.6.4.0
0034c000 16 RW --- 000000000006f000 008:00003 libfreetype. so.6.4.0
00350000 72 R-X -- 0000000000000000 008:00003 libz. so.1.2.3
00362000 4 RW --- 0000000000011000 008:00003 libz. so.1.2.3
00363000 60 r-X -- 0000000000000000 008:00003 libresolv-2.5.so
00372000 4 R ---- 000000000000e000 008:00003 libresolv-2.5.so
00373000 4 RW --- 000000000000f000 008:00003 libresolv-2.5.so
00374000 8 RW --- 0000000000374000 000:00000 [Anon]
00376000 76 R-X -- 0000000000000000 008:00003 libnsl-2.5.so
00389000 4 R ---- 0000000000012000 libnsl-2.5.so
0038a000 4 RW --- 0000000000013000 libnsl-2.5.so
0038b000 8 RW --- 000000000038b000 000:00000 [Anon]
0038d000 200 r-X -- 0000000000000000 008:00003 libcurl. so.3.0.0
003bf000 4 RW --- 0000000000031000 libcurl. so.3.0.0
003c0000 192 R-X -- 0000000000000000 008:00003 libidn. so.11.5.19
003f0000 4 RW --- 000000000002f000 008:00003 libidn. so.11.5.19
003f1000 188 R-X -- 0000000000000000 008:00003 libxslt. so.1.1.15
00420000 4 RW --- 000000000002f000 008:00003 libxslt. so.1.1.15
00421000 588 R-X -- 0000000000000000 008:00003 libkrb5.so. 3.3
004b4000 12 RW --- 0000000000092000 008:00003 libkrb5.so. 3.3
004b7000 8 R-X -- 0000000000000000 008:00003 libcom_err.so.2.1
004b9000 4 RW --- 0000000000001000 008:00003 libcom_err.so.2.1
004ba000 148 R-X -- 0000000000000000 008:00003 libk5crypto. so.3.1
004df000 4 RW --- 0000000000025000 008:00003 libk5crypto. so.3.1
004e0000 8 R-X -- 0000000000000000 008:00003 libkeyutils-1.2.so
004e2000 4 RW --- 0000000000001000 libkeyutils-1.2.so
004e3000 36 R-X -- 0000000000000000 008:00003 libnss_files-2.5.so
004ec000 4 R ---- 0000000000008000 libnss_files-2.5.so
004ed000 4 RW --- 0000000000009000 libnss_files-2.5.so
004f4000