LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tim Schmielau <tim@physik3.uni-rostock.de>
To: Johann Schuster <johann.schuster@unibw.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Measuring cpu time using getrusage
Date: Sat, 17 Feb 2007 13:09:58 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.63.0702171302570.20161@gockel.physik3.uni-rostock.de> (raw)
In-Reply-To: <45D30BDF.5010608@unibw.de>

On Wed, 14 Feb 2007, Johann Schuster wrote:

> currently i'm trying to measure the cpu times for
> numerical algorithms written in C using two calls of
> getrusage() and then calculating the time difference.
> 
> According to the man page of getrusage i looked at the
> user time of my process. Surprisingly the measured user
> times vary strongly depending on the system load of the
> machine.
> A heavy system load nearly doubles the measured time
> for my routine.

Does your system have hyperthreading? (look at whether the siblings field 
in /proc/cpuinfo is greater than one)
If yes, there is no way to accurately measure runtimes because the 
(single-threaded) performance of your CPU depends on the other tasks 
running. Just disable hyperthreading for these measurements.

Tim

      reply	other threads:[~2007-02-17 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-14 13:17 Johann Schuster
2007-02-17 12:09 ` Tim Schmielau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.63.0702171302570.20161@gockel.physik3.uni-rostock.de \
    --to=tim@physik3.uni-rostock.de \
    --cc=johann.schuster@unibw.de \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: Measuring cpu time using getrusage' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).