From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753467Ab0APOEL (ORCPT ); Sat, 16 Jan 2010 09:04:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753350Ab0APOEK (ORCPT ); Sat, 16 Jan 2010 09:04:10 -0500 Received: from www.liacc.up.pt ([193.136.27.99]:42496 "EHLO mail.ncc.up.pt" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752280Ab0APOEJ (ORCPT ); Sat, 16 Jan 2010 09:04:09 -0500 X-Greylist: delayed 1860 seconds by postgrey-1.27 at vger.kernel.org; Sat, 16 Jan 2010 09:04:09 EST Date: Sat, 16 Jan 2010 13:34:15 +0000 Message-ID: From: Marco Almeida To: linux-kernel@vger.kernel.org Subject: Measuring CPU time with getrusage User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.1 (x86_64-pc-solaris2.11) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I'm trying to measure the CPU time of several algorithms (some written in C others in Python) by using getrusage() after wait() for the child process to end. On a machine with hypterthreading, the measured user times depend a lot on the system load of the machine. A heavy system load sometimes increases the measured time by 10x! Is there a better way to measure the used CPU time of a given process (or part of a program) or have I missed some important fact? Any help appreciated. Thanks, Marco