How can I monitor per process/per thread memory consumption (divided into heap, stack, data, code)?
Clash Royale CLAN TAG#URR8PPP
up vote
10
down vote
favorite
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?
linux memory stack
add a comment |Â
up vote
10
down vote
favorite
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?
linux memory stack
Looks like most of this info is in/proc/$PID/smaps
â Bratchley
Jan 21 '15 at 15:01
That's right, but I was hoping there is some tool that I can run and automatically outputs the memory information.
â Alex Dima
Jan 22 '15 at 8:21
I'm sure there are memory profilers out there for someone with specific needs. Most people could just periodically save the contents of that proc file. FWIW it sounds like one of valgrind's components has a pretty good profiler. I've never used it but maybe it's a direction for you to go into.
â Bratchley
Jan 22 '15 at 15:35
add a comment |Â
up vote
10
down vote
favorite
up vote
10
down vote
favorite
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?
linux memory stack
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?
linux memory stack
linux memory stack
edited Jan 27 '15 at 15:44
Agi Hammerthief
344118
344118
asked Jan 21 '15 at 14:51
Alex Dima
51115
51115
Looks like most of this info is in/proc/$PID/smaps
â Bratchley
Jan 21 '15 at 15:01
That's right, but I was hoping there is some tool that I can run and automatically outputs the memory information.
â Alex Dima
Jan 22 '15 at 8:21
I'm sure there are memory profilers out there for someone with specific needs. Most people could just periodically save the contents of that proc file. FWIW it sounds like one of valgrind's components has a pretty good profiler. I've never used it but maybe it's a direction for you to go into.
â Bratchley
Jan 22 '15 at 15:35
add a comment |Â
Looks like most of this info is in/proc/$PID/smaps
â Bratchley
Jan 21 '15 at 15:01
That's right, but I was hoping there is some tool that I can run and automatically outputs the memory information.
â Alex Dima
Jan 22 '15 at 8:21
I'm sure there are memory profilers out there for someone with specific needs. Most people could just periodically save the contents of that proc file. FWIW it sounds like one of valgrind's components has a pretty good profiler. I've never used it but maybe it's a direction for you to go into.
â Bratchley
Jan 22 '15 at 15:35
Looks like most of this info is in
/proc/$PID/smaps
â Bratchley
Jan 21 '15 at 15:01
Looks like most of this info is in
/proc/$PID/smaps
â Bratchley
Jan 21 '15 at 15:01
That's right, but I was hoping there is some tool that I can run and automatically outputs the memory information.
â Alex Dima
Jan 22 '15 at 8:21
That's right, but I was hoping there is some tool that I can run and automatically outputs the memory information.
â Alex Dima
Jan 22 '15 at 8:21
I'm sure there are memory profilers out there for someone with specific needs. Most people could just periodically save the contents of that proc file. FWIW it sounds like one of valgrind's components has a pretty good profiler. I've never used it but maybe it's a direction for you to go into.
â Bratchley
Jan 22 '15 at 15:35
I'm sure there are memory profilers out there for someone with specific needs. Most people could just periodically save the contents of that proc file. FWIW it sounds like one of valgrind's components has a pretty good profiler. I've never used it but maybe it's a direction for you to go into.
â Bratchley
Jan 22 '15 at 15:35
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
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
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
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
add a comment |Â
up vote
4
down vote
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
add a comment |Â
up vote
4
down vote
up vote
4
down vote
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
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
edited Sep 5 at 11:54
valiano
1348
1348
answered Feb 1 '15 at 14:03
undefine
875516
875516
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f180287%2fhow-can-i-monitor-per-process-per-thread-memory-consumption-divided-into-heap%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Looks like most of this info is in
/proc/$PID/smaps
â Bratchley
Jan 21 '15 at 15:01
That's right, but I was hoping there is some tool that I can run and automatically outputs the memory information.
â Alex Dima
Jan 22 '15 at 8:21
I'm sure there are memory profilers out there for someone with specific needs. Most people could just periodically save the contents of that proc file. FWIW it sounds like one of valgrind's components has a pretty good profiler. I've never used it but maybe it's a direction for you to go into.
â Bratchley
Jan 22 '15 at 15:35