From owner-freebsd-hackers Mon May 13 2:55:32 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from room101.wuppy.net.ru (room101.WUPPY.NET.RU [212.30.189.131]) by hub.freebsd.org (Postfix) with ESMTP id 3602637B401 for ; Mon, 13 May 2002 02:55:22 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by room101.wuppy.net.ru (8.11.6/8.11.6) with ESMTP id g4D9sXt96231; Mon, 13 May 2002 13:54:43 +0400 (MSD) (envelope-from romanp@unshadow.net) Date: Mon, 13 May 2002 13:54:32 +0400 (MSD) From: "Roman V. Palagin" To: Ed Hall Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Memory and Reality In-Reply-To: <200205112015.g4BKFt390577@screech.weirdnoise.com> Message-ID: <20020513130532.U83794-100000@room101.wuppy.net.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 ' 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