Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 May 2002 13:54:32 +0400 (MSD)
From:      "Roman V. Palagin" <romanp@unshadow.net>
To:        Ed Hall <edhall@weirdnoise.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Memory and Reality
Message-ID:  <20020513130532.U83794-100000@room101.wuppy.net.ru>
In-Reply-To: <200205112015.g4BKFt390577@screech.weirdnoise.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On May 11, at 1:15pm -0700, Ed Hall wrote:

> At Yahoo! we use a lot of shared memory, both in the form of .so's and
> for IPC.  It would be very useful to be able to accurately measure the
> amount of shared and private memory associated with a process, the
> number of references to a given shared memory object, resident vs. non-
> resident pages, and so forth.

Try to look at

ftp://ftp.wuppy.net.ru/pub/FreeBSD/local/pmap/pmap-20010226.tar.gz

This is tool simular to Solaris' pmap. You need to compile and install
pmap_helper, then compile pmap itself (pmap.d is very verbose development
version of pmap, you may want to look at it if you understand some VM's
internals :). You can run pmap w/out args, it will list all processes or
'pmap <pid>' to get info about specific pid. Output will looks like this
one:

22469:  smbd
Address  Kbytes Resident Shared Private Protection      Mapped File
08048000   1184      300      -     600 read/exec       /usr/local/sbin/smbd
08170000    152       12      -     152 read/write      /usr/local/sbin/smbd
08196000    240        -      -       - read/write      [swap pager]
081D2000    356        -      -       - read/write/exec [swap pager]
28170000     68       52     68       - read/exec       /usr/libexec/ld-elf.so.1
28181000      4        4      4       - read/write      /usr/libexec/ld-elf.so.1
28182000      8        -      -       - read/write      [swap pager]
28184000     32        -      -       - read/write/exec [swap pager]
2818C000     32       32     32       - read/exec       /usr/lib/libpam.so.1
28194000      4        4      4       - read/write/exec /usr/lib/libpam.so.1
28195000    512      448    512       - read/exec       /usr/lib/libc.so.4
28215000     20       16     20       - read/write/exec /usr/lib/libc.so.4
2821A000     84        -      -       - read/write/exec [swap pager]
2822F000      8        4      8       - read/write/exec /usr/local/private/secrets.tdb
28231000      4        0      4       - read/write/exec /var/spool/samba/messages.tdb
28232000      8       16      8       - read/write/exec /var/spool/samba/connections.tdb
BFBE0000    128        -      -       - read/write/exec [swap pager]
-------- ------ -------- ------ -------
Total      2844      888    660     752


The only error you should get during compilation is pmap/ncache.c:53.
Basicaly, just replace 420001 by actual version of FreeBSD you have.

If you have any problems compiling/running this stuff - feel free to
contact me at romanp@unshadow.net.

p.s. (to all who will try this program). I know, in some cases it not
accurate (will count some memory twice). Don't shoot me for this piece of
code - I do the best I can :) Better tell me what's wrong and we will
create powerfull tool!
                                             - Roman
---
Any opinions in this posting are my own and not those of my present
or previous employers.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020513130532.U83794-100000>