linux包之procps之pmap命令
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
linux包之procps之pmap命令
名称:
pmap - report memory map of a process(查看进程的内存映像信息)
⽤法
pmap [ -x | -d ] [ -q ] pids...
pmap -V
选项含义
-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. 显⽰版本
扩展格式和设备格式域:
Address: start address of map 映像起始地址
Kbytes: size of map in kilobytes 映像⼤⼩
RSS: resident set size in kilobytes 驻留集⼤⼩
Dirty: dirty pages (both shared and private) in kilobytes 脏页⼤⼩
Mode: permissions on map 映像权限: r=read, w=write, x=execute, s=shared, p=private (copy on write)
Mapping: file backing the map , or '[ anon ]' for allocated memory, or '[ stack ]' for the program stack. 映像⽀持⽂件,[anon]为已分配内存[stack]为程序堆栈
Offset: offset into the file ⽂件偏移
Device: device name (major:minor) 设备名
pmap -d 1
pmap -d 1 -q 不显⽰头尾
[root@C44 ~]# while true; do pmap -d 3066 | tail -1; sleep 2; done 循环显⽰进程3066的设备格式的最后1⾏,间隔2秒,
最后⼀⾏的值
mapped 表⽰该进程映射的虚拟地址空间⼤⼩,也就是该进程预先分配的虚拟内存⼤⼩,即ps出的vsz
writeable/private 表⽰进程所占⽤的私有地址空间⼤⼩,也就是该进程实际使⽤的内存⼤⼩
shared 表⽰进程和其他进程共享的内存⼤⼩
[root@250-shiyan bin]# pmap -x 14644
14644: sshd: root@pts/0
Address Kbytes RSS Dirty Mode Mapping
00007f979d216000 964944944 rw--- [ anon ]
00007f979d3a0000 128044 rw-s- zero (deleted)
00007f979d4e0000 16160 r-x-- pam_limits.so
00007f979d4e4000 204400 ----- pam_limits.so
00007f979d6e3000 444 r---- pam_limits.so
00007f979d6e4000 444 rw--- pam_limits.so
00007f979d6e5000 880 r-x-- pam_keyinit.so
[root@250-shiyan bin]# pmap -d 14644
14644: sshd: root@pts/0
Address Kbytes Mode Offset Device Mapping
00007f979d216000 964 rw--- 0000000000000000000:00000 [ anon ]
00007f979d3a0000 1280 rw-s- 0000000000000000000:00004 zero (deleted)
00007f979d4e0000 16 r-x-- 0000000000000000 0fd:00000 pam_limits.so
00007f979d4e4000 2044 ----- 0000000000004000 0fd:00000 pam_limits.so
[root@221-comecs ~]# watch -d -n 1 'ss -n|grep 10001'
15:19:16 23 ~:#uptime
15:28:15 up 38 days, 3:57, 2 users, load average: 0.00, 0.00, 0.00
snice与skill是⼀对,pgrep与pkill是⼀对
pgrep, pkill - look up or signal processes based on name and other attributes
pgrep根据⽤户名,命令名或者其它属性过滤出pid,⾮常⽅便,pkill发送相应的信号
[root@109-com1 bin]# pgrep F
26195
root 26195 1 4 Jul23 pts/2 01:00:28 /usr/local/ps/bin/FLTService
15:31:39 25 ~:#ldd /usr/bin/uptime
linux-vdso.so.1 => (0x00007fff291ff000)
libproc-3.2.8.so => /lib64/libproc-3.2.8.so (0x00007f2a52250000) libc.so.6 => /lib64/libc.so.6 (0x00007f2a51ebc000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2a5247a000)
15:31:52 26 ~:#ldd /usr/bin/w
linux-vdso.so.1 => (0x00007fffd8326000)
libproc-3.2.8.so => /lib64/libproc-3.2.8.so (0x00007f4f54789000) libc.so.6 => /lib64/libc.so.6 (0x00007f4f543f5000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4f549b3000)
15:32:15 27 ~:#ldd /usr/bin/vmstat
linux-vdso.so.1 => (0x00007fff029ff000)
libproc-3.2.8.so => /lib64/libproc-3.2.8.so (0x00007fbf227d6000) libc.so.6 => /lib64/libc.so.6 (0x00007fbf22442000)
/lib64/ld-linux-x86-64.so.2 (0x00007fbf22a00000)
procps相关⼯具都调⽤同⼀个库
[oracle@localhost ~]$ rpm -ql procps
/bin/ps
/lib64/libproc-3.2.8.so
/lib64/libproc.so
/sbin/sysctl
/usr/bin/free
/usr/bin/pgrep
/usr/bin/pkill
/usr/bin/pmap
/usr/bin/pwdx
/usr/bin/skill
/usr/bin/slabtop
/usr/bin/snice
/usr/bin/tload
/usr/bin/top
/usr/bin/uptime
/usr/bin/vmstat
/usr/bin/w
/usr/bin/watch。