From owner-freebsd-stable@FreeBSD.ORG Sun Dec 19 22:17:20 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB832106566B for ; Sun, 19 Dec 2010 22:17:20 +0000 (UTC) (envelope-from kometen@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 6AA988FC12 for ; Sun, 19 Dec 2010 22:17:20 +0000 (UTC) Received: by qwj9 with SMTP id 9so2108475qwj.13 for ; Sun, 19 Dec 2010 14:17:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=k+HKfp8H9cBvQiMqql55WVYWNpUMRf6KJ32sHnzSH0U=; b=CSvvEm2TCQt8Otiyv6/z2jat301eoe/prGDqlpSL51xh9FKbMyjXEHfivX++tszrjX 9fxZYlAvJhTnwKe1oZQuaPsdM7t1MRLXJR5WDigbulWDQ8dMGBQf4C9AGnY6mT/WLBF6 GCy1gWbckba8t50PbvG1M58eIvgxENphOFl7Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=OADy5j4oKUL0RZ++TiTF9FloAuhvxtS0J28RGLjf64KkKPIs+uAD2wkjVJ8Gl/j5fq 6EbTtHhOv4JpLuQUmEkrhI+8Jsb1v9jvMMBC3RvBI8aQryCwjvRu1topkcqncTcufTur 6DCZXRr1BuIX4mmSyJDVAJgE1p5Fe5ZDMRyg4= MIME-Version: 1.0 Received: by 10.229.43.72 with SMTP id v8mr3112994qce.290.1292795462577; Sun, 19 Dec 2010 13:51:02 -0800 (PST) Received: by 10.229.95.205 with HTTP; Sun, 19 Dec 2010 13:51:02 -0800 (PST) Date: Sun, 19 Dec 2010 22:51:02 +0100 Message-ID: From: Claus Guttesen To: freebsd-stable@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: get ram usage using getrusage() X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Dec 2010 22:17:20 -0000 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