From: Joel Becker <Joel.Becker@oracle.com>
To: george anzinger <george@mvista.com>
Cc: john stultz <johnstul@us.ibm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Clock monotonic a suggestion
Date: Fri, 21 Mar 2003 11:43:00 -0800 [thread overview]
Message-ID: <20030321194300.GB31586@ca-server1.us.oracle.com> (raw)
In-Reply-To: <3E7AC6C9.5000401@mvista.com>
On Fri, Mar 21, 2003 at 12:01:13AM -0800, george anzinger wrote:
> To carry this to the absurd, it also precludes most anything other
> than a GPS or WWV based clock. If we are to have any clock that is
No, cycle counters do just fine.
> >1 gettimeofday = 1000000000
> >2 driver delays 10s
> >3 gettimeofday = 1000000000
> >4 timer notices lag and adjusts
>
> Uh, how is this done? At this time there IS correction for delays up
> to about a second built into the gettimeofday() code. You seem to be
> assuming that we can do better than this with clock monotonic. Given
> the right hardware, this may even be possible, but why not correct
> gettimeofday in the same way?
monotonic_clock as proposed uses a hardware clock.
Specifically, the TSC on vanilla intel, the Cyclone timer on x440, and
associated clocks on S/390 (to speak of platforms I've visited
recently). Right now, the hangcheck-timer accesses the hardware counter
directly. monotonic_clock is intended as a portable and consistent
accessor instead.
The current gettimeofday() corrects for ~1s. Even if we found a
way to correct for ~1000s or more, there would still be a race between
when the caller reads and when the correction happens. A clock that
reads a hardware counter doesn't have this problem.
If code doesn't need this accuracy, it can just use
gettimeofday().
Joel
--
"Glory is fleeting, but obscurity is forever."
- Napoleon Bonaparte
Joel Becker
Senior Member of Technical Staff
Oracle Corporation
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127
next prev parent reply other threads:[~2003-03-21 20:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-21 0:16 george anzinger
2003-03-21 2:50 ` Joel Becker
2003-03-21 5:53 ` Chris Friesen
2003-03-21 8:10 ` george anzinger
2003-03-21 8:01 ` george anzinger
2003-03-21 19:43 ` Joel Becker [this message]
2003-03-21 20:53 ` john stultz
2003-03-21 13:17 ` Martin Waitz
2003-03-21 19:18 ` george anzinger
2003-03-21 19:46 ` Joel Becker
2003-03-21 19:44 ` Joel Becker
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=20030321194300.GB31586@ca-server1.us.oracle.com \
--to=joel.becker@oracle.com \
--cc=george@mvista.com \
--cc=johnstul@us.ibm.com \
--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
all inboxes | Powered by JetHome®