From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 3 20:13:10 2008 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 DDAD11065673 for ; Thu, 3 Jul 2008 20:13:10 +0000 (UTC) (envelope-from stephen@math.missouri.edu) Received: from math.missouri.edu (math.missouri.edu [128.206.184.200]) by mx1.freebsd.org (Postfix) with ESMTP id 9FFB58FC12 for ; Thu, 3 Jul 2008 20:13:10 +0000 (UTC) (envelope-from stephen@math.missouri.edu) Received: from [128.206.184.213] (cauchy.math.missouri.edu [128.206.184.213]) by math.missouri.edu (8.13.1/8.13.1) with ESMTP id m63KD9QL064629 for ; Thu, 3 Jul 2008 15:13:10 -0500 (CDT) (envelope-from stephen@math.missouri.edu) Message-ID: <486D32A2.6030608@math.missouri.edu> Date: Thu, 03 Jul 2008 15:12:18 -0500 From: Stephen Montgomery-Smith User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.13) Gecko/20080701 SeaMonkey/1.1.9 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.88/7631/Thu Jul 3 13:13:01 2008 on math.missouri.edu X-Virus-Status: Clean Subject: time used by a thread 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, 03 Jul 2008 20:13:11 -0000 I want to use getrusage to see how much time a program is using. But this is a multithreaded program, and I just want the time taken by that particular thread! I know this info must be available somewhere, because top -H seems to provide it. But getrusage seems to give the total rusage for the whole program, not just the thread. Any ideas? I would especially appreciate a portable solution that works for OS other than FreeBSD (e.g. linux, etc as well). I tried "apropos thread | grep usage".