How can I monitor per process/per thread memory consumption (divided into heap, stack, data, code)?
21,168
You can see some information using pmap -x PID
- it's divided into kbytes, rss and dirty memory for each library/module/open file/stack of a process:
undefine@uml:~$ pmap -x 13206 13206: sleep 60 Address Kbytes RSS Dirty Mode Mapping 0000000000400000 24 20 0 r-x-- sleep 0000000000606000 4 4 4 r---- sleep 0000000000607000 4 4 4 rw--- sleep 000000000063b000 132 8 8 rw--- [ anon ] 00007f6a9847e000 4308 44 0 r---- locale-archive 00007f6a988b3000 1772 376 0 r-x-- libc-2.19.so 00007f6a98a6e000 2048 0 0 ----- libc-2.19.so 00007f6a98c6e000 16 16 16 r---- libc-2.19.so 00007f6a98c72000 8 8 8 rw--- libc-2.19.so 00007f6a98c74000 20 12 12 rw--- [ anon ] 00007f6a98c79000 140 116 0 r-x-- ld-2.19.so 00007f6a98e71000 12 12 12 rw--- [ anon ] 00007f6a98e99000 8 8 8 rw--- [ anon ] 00007f6a98e9b000 4 4 4 r---- ld-2.19.so 00007f6a98e9c000 4 4 4 rw--- ld-2.19.so 00007f6a98e9d000 4 4 4 rw--- [ anon ] 00007fff09fd0000 132 12 12 rw--- [ stack ] 00007fff09ffe000 8 4 0 r-x-- [ anon ] ffffffffff600000 4 0 0 r-x-- [ anon ] ---------------- ------- ------- ------- total kB 8652 656 96
Related videos on Youtube
Author by
tanmay
Updated on September 18, 2022Comments
-
tanmay almost 2 years
Before jumping in and writing my own code, I want to find out if there is GNU/Linux software that is able to output something similar to QNX's
showmem
.For each thread of each process that is running, I would like to see the memory consumption divided into the following categories:
Process listing (Total, Code, Data, Heap, Stack, Other) 319488 1024000 24587 167936 24576 0 4103 devc-con-hid (thread 2) 0 0 0 0 4096 0 4103 devc-con-hid (thread 2) 0 0 0 0 20480 0 4103 devc-con-hid (thread 1) 0 102400 8192 0 0 0 4103 devc-con-hid (proc/boot/devc-con-hid) 0 0 16384 0 0 0 4103 devc-con-hid (proc/boot/libc.so.3) 0 0 0 0 0 ( 36864) 4103 devc-con-hid (/dev/mem)
Is there anything that will make this possible?