Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Dec 2010 16:30:43 -0800
From:      Jeremy Chadwick <freebsd@jdc.parodius.com>
To:        Claus Guttesen <kometen@gmail.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: get ram usage using getrusage()
Message-ID:  <20101220003042.GB51776@icarus.home.lan>
In-Reply-To: <AANLkTi=6rnad2fWcL444BZBK6PzHFRNkf-F3uvEbEAC6@mail.gmail.com>
References:  <AANLkTi=6rnad2fWcL444BZBK6PzHFRNkf-F3uvEbEAC6@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 19, 2010 at 10:51:02PM +0100, Claus Guttesen wrote:
> I'm trying to read how much ram an app is using reading
> http://unix.derkeiler.com/Mailing-Lists/FreeBSD/stable/2006-03/msg00246.html
> from ru.ru_maxrss. While ru.ru_maxrss gives me used accurate ram-usage
> when memory increases it doesn't immediately count down when memory is
> released.
> 
> So I tried to get a more accurate reading using this using
> /usr/src/sys/kern/kern_clock.c as example:
> 
> struct thread *td;
> td = curthread;
> p = td->td_proc;
> vm = p->p_vmspace;
> rss = pgtok(vmspace_resident_count(vm));
> 
> Curthread is not defined, I searched google but can't find any references.
> 
> But is this the proper way to get an apps memory usage?

This question might be better suited for the freebsd-hackers mailing
list.

-- 
| Jeremy Chadwick                                   jdc@parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.               PGP 4BD6C0CB |




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