get ram usage using getrusage()
Claus Guttesen
kometen at gmail.com
Sun Dec 19 22:17:20 UTC 2010
Hi.
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?
--
regards
Claus
When lenity and cruelty play for a kingdom,
the gentler gamester is the soonest winner.
Shakespeare
twitter.com/kometen
More information about the freebsd-stable
mailing list