I really appreciate your script, it makes tracking down memory usage much easier. However, I've noticed a few areas where it doesn't work as advertised. Below, I've included the last 5 lines output from each command respectively
On OpenSUSE 15.0, the output of pmap 1 (pmap from procps-ng 3.3.12) looks like this:
...
00007ffde332c000 12 0 0 0 0 r--p- [ anon ]
00007ffde332f000 8 4 0 0 0 r-xp- [ anon ]
ffffffffff600000 4 0 0 0 0 r-xp- [ anon ]
total kB 222568 6704 2402 1832 640
Please forgive the misalignment in this copy/paste. Further, it seems that Github is "helping" me correct my formatting in this post, so it's not exactly as seen.
While on SLES 11.4 (procps version 3.2.7), pmap 1 looks like this:
...
00007ffc833cb000 4K 4K 0K 0K 0K r-xp [vdso]
ffffffffff600000 4K 0K 0K 0K 0K r-xp [vsyscall]
Total: 10560K 636K 79K 48K 88K
336K writable-private, 10224K readonly-private, 0K shared, and 636K referenced
As you can see, I get totally different outputs between the two versions. To fix this, I had to use the following variations on your command for extracting the $MEMORY value:
Admittedly, SLES 11.4 is old, but I don't know how many other variants exist out there, and since both of these options are different from your original, I figured I'd let you know.
Hello,
I really appreciate your script, it makes tracking down memory usage much easier. However, I've noticed a few areas where it doesn't work as advertised. Below, I've included the last 5 lines output from each command respectively
On OpenSUSE 15.0, the output of pmap 1 (pmap from procps-ng 3.3.12) looks like this: ... 00007ffde332c000 12 0 0 0 0 r--p- [ anon ] 00007ffde332f000 8 4 0 0 0 r-xp- [ anon ] ffffffffff600000 4 0 0 0 0 r-xp- [ anon ]
total kB 222568 6704 2402 1832 640
Please forgive the misalignment in this copy/paste. Further, it seems that Github is "helping" me correct my formatting in this post, so it's not exactly as seen.
While on SLES 11.4 (procps version 3.2.7), pmap 1 looks like this: ... 00007ffc833cb000 4K 4K 0K 0K 0K r-xp [vdso] ffffffffff600000 4K 0K 0K 0K 0K r-xp [vsyscall] Total: 10560K 636K 79K 48K 88K
336K writable-private, 10224K readonly-private, 0K shared, and 636K referenced
As you can see, I get totally different outputs between the two versions. To fix this, I had to use the following variations on your command for extracting the $MEMORY value:
OpenSUSE 15: pmap $PID | tail -n1 | awk '{print $3"KB"}'
SLES 11.4: pmap $PID | tail -n3 | head -n1 | awk '/[0-9]K/{print $2}'
Admittedly, SLES 11.4 is old, but I don't know how many other variants exist out there, and since both of these options are different from your original, I figured I'd let you know.
thanks for the script, Greg