linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Friesen <cfriesen@nortelnetworks.com>
To: Maciej Soltysiak <solt@dns.toxicfilms.tv>
Cc: linux-kernel@vger.kernel.org
Subject: Re: timing an application
Date: Tue, 14 Jan 2003 15:07:01 -0500	[thread overview]
Message-ID: <3E246DE5.7080302@nortelnetworks.com> (raw)
In-Reply-To: Pine.LNX.4.51.0301142044400.6432@dns.toxicfilms.tv

Maciej Soltysiak wrote:
> Hi,
> 
> being inspired by some book about optimizing c++ code i decided to do
> timing of functions i wrote. I am using gettimeofday to set
> two timeval structs and calculate the time between them.
> But the results depend heavily on the load, also i reckon that this
> is an innacurate timing.
> 
> Any ideas on timing a function, or a block of code? Maybe some kernel
> timers or something.

gettimeofday() is accurate.  However, your task may be interrupted by
other tasks, interrupts, etc.

Your best bet may be to do many iterations of the routine in question and then
do some statistical analysis of the results.

Chris



-- 
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com


  reply	other threads:[~2003-01-14 19:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-14 19:58 timing an application Maciej Soltysiak
2003-01-14 20:07 ` Chris Friesen [this message]
2003-01-14 20:38   ` Corey Minyard
2003-01-14 20:20 ` Richard B. Johnson
2003-01-15 12:21   ` timing an application [results] Maciej Soltysiak
2003-01-14 22:09 ` timing an application Olaf Dietsche
2003-01-14 20:37 Howell, David P
2003-01-14 21:34 ` David Mosberger

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=3E246DE5.7080302@nortelnetworks.com \
    --to=cfriesen@nortelnetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=solt@dns.toxicfilms.tv \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).