public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Christopher Friesen" <cfriesen@nortelnetworks.com>
To: Kotsovinos Vangelis <kotsovin@ics.forth.gr>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Microsecond accuracy
Date: Thu, 07 Dec 2000 11:54:30 -0500	[thread overview]
Message-ID: <3A2FC0C6.3F11057B@nortelnetworks.com> (raw)
In-Reply-To: <Pine.GSO.4.10.10012071337530.7874-100000@athena.ics.forth.gr>

Kotsovinos Vangelis wrote:
> 
> Is there any way to measure (with microsecond accuracy) the time of a
> program execution (without using Machine Specific Registers) ?
> I've already tried getrusage(), times() and clock() but they all have
> 10 millisecond accuracy, even though they claim to have microsecond
> acuracy.
> The only thing that seems to work is to use one of the tools that measure
> performanc through accessing the machine specific registers. They give you
> the ability to measure the clock cycles used, but their accuracy is also
> very low from what I have seen up to now.

Can you not just use something like gettimeofday()?  Do two consecutive calls to
find the execution time of the instruction itself, and then do two calls on
either side of the program execution.  Subtract the instruction execution time
from the delta, and that should give a pretty good idea of execution time.

On a 400Mhz G4, getttimeofday() consistantly takes 2 microseconds to run.

-- 
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-12-07 17:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-07 11:42 Microsecond accuracy Kotsovinos Vangelis
2000-12-07 12:36 ` Tigran Aivazian
2000-12-07 14:13   ` Tigran Aivazian
2000-12-07 15:33     ` H. Peter Anvin
2000-12-07 16:07       ` Maciej W. Rozycki
2000-12-07 19:28         ` [PATCH] setup.c notsc " Hugh Dickins
2000-12-07 20:48           ` Maciej W. Rozycki
2000-12-13 14:10           ` H. Peter Anvin
2000-12-07 16:54 ` Christopher Friesen [this message]
2000-12-08  0:17   ` Kotsovinos Vangelis
2000-12-07 21:14 ` Karim Yaghmour
2000-12-08  0:18   ` Kotsovinos Vangelis

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=3A2FC0C6.3F11057B@nortelnetworks.com \
    --to=cfriesen@nortelnetworks.com \
    --cc=kotsovin@ics.forth.gr \
    --cc=linux-kernel@vger.kernel.org \
    /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