From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 20 18:23:06 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2058A106566B for ; Thu, 20 Oct 2011 18:23:06 +0000 (UTC) (envelope-from strontium90@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id A8BF28FC0A for ; Thu, 20 Oct 2011 18:23:05 +0000 (UTC) Received: by wwi18 with SMTP id 18so4556773wwi.31 for ; Thu, 20 Oct 2011 11:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=eo0wlcGhPYo6vNWJDEXD4LrDzzPxCsIHVWex5l5jJ0s=; b=gm3N1b2JfsF8hNS3ZVBlyT9G7WObeuMrZTWjkYhO/67nWkvLRT4o8H0xsk5MLqJI0D uRjSTJFwHz2+A1Ex6gurMjmUEzBuqbRxaDLcRdleYB/ODA2IkDsIow0rSWss78DVppan a4aLxhWK2bflkbidgy5tKfARLGUn7N/Bm5w2Y= Received: by 10.227.7.94 with SMTP id c30mr4296508wbc.44.1319133482873; Thu, 20 Oct 2011 10:58:02 -0700 (PDT) Received: from iv-sv-328.creatis.insa-lyon.fr (iv-sv-328.creatis.insa-lyon.fr. [195.220.108.195]) by mx.google.com with ESMTPS id o17sm15045811wbm.6.2011.10.20.10.58.00 (version=SSLv3 cipher=OTHER); Thu, 20 Oct 2011 10:58:01 -0700 (PDT) Message-ID: <4EA0610B.90206@gmail.com> Date: Thu, 20 Oct 2011 19:57:31 +0200 From: Razmig K User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0) Gecko/20111003 Thunderbird/7.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Measuring memory footprint in C/C++ code on FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2011 18:23:06 -0000 Hello I'd like to measure the memory footprint in C/C++ code for a program running under FreeBSD and Linux in terms of total process size including heap objects. Due to execution length, I'd like to avoid the use of valgrind. I think that it would be difficult to achieve the task in a platform-transparent manner, that's why I'll be using /proc//status on Linux, and do something else on FreeBSD. I was adviced to have a look on getrusage, which I did, but I found descriptions of certain fields of struct rusage in the manpage too cryptic to make a proper use of the call. Could someone please point me in the right direction? Thanks very much. ~Razmig