From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 09:30:46 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DBD8237B401 for ; Sun, 6 Jul 2003 09:30:46 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5CD4244005 for ; Sun, 6 Jul 2003 09:30:46 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfmrb.dialup.mindspring.com ([165.247.219.107] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZCPT-0002M5-00; Sun, 06 Jul 2003 09:30:44 -0700 Message-ID: <3F084E75.1CC3058@mindspring.com> Date: Sun, 06 Jul 2003 09:29:41 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Vivek Khera References: <16133.55711.263062.288990@yertle.int.kciLink.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a403615f51df4b911179d401bec010f1d4350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: hackers@freebsd.org Subject: Re: process sizes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 16:30:47 -0000 Vivek Khera wrote: > Now, currently, the BSD code from SizeLimit reads like this: > > sub bsd_size_check { > return (&BSD::Resource::getrusage())[2,3]; > } > > This routine is intended to return the current process size and shared > memory size. However, the getrusage() above is not really doing what > is intended. The shared pages value returned is way wrong (only text > pages are given by getrusage) and the current process size is not the > MAX RSS, which is returned above. > > I'm at a loss as to what to use to measure the current process size > and also to measure the amount of virtual memory in use by that > process that is in shared pages. > If anyone has good code to get this information on FreeBSD (and other > BSD's in general) please let me know. If additional libraries are > needed, that's ok. If we have to poke around /proc, that's ok to. > > I'd appreciate direct replies since I'm away at OSCON next week and > don't want to miss anything. Thanks. You are aware that POSIX only requires that the struct rusage have system and user timeval members, right? http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/resource.h.html -- Terry