linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: Martin Waitz <tali@admingilde.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Clock monotonic  a suggestion
Date: Fri, 21 Mar 2003 11:18:55 -0800	[thread overview]
Message-ID: <3E7B659F.9020407@mvista.com> (raw)
In-Reply-To: <20030321131744.GL27366@admingilde.org>

Martin Waitz wrote:
> On Thu, Mar 20, 2003 at 04:16:13PM -0800, george anzinger wrote:
> 
>>Define CLOCK_MONOTONIC to be the same as
>>(gettimeofday() + wall_to_monotonic).
> 
> 
> why don't you simply use asm("rdtsc") ?
> (ok, you should make sure that you always ask the same processor and
> stuff, but using the built in TSC seems to do everything you want...)
> 
> 
I don't really understand how :(

I want a tick on CLOCK_MONOTONIC to be the same size as a tick on 
gettimeofday() over the life of the system.  I.e. lock step.  The only 
difference is that CLOCK_MONOTONIC can not be set, so, if we use the 
above, wall_to_monotonic must be adjusted when the gettimeofday() 
clock is set (but not when it is "adjusted" by NTP).

asm("rdtsc") is, first of all, only useful on x86 platforms, 
CLOCK_MONOTONIC is in the POSIX clocks and timers code and in all 
platforms.  Second, each platform has an equivalent, best guess, way 
of filling in the time information below the 1/HZ level (and yes, some 
x86 platforms use TSC) already in the gettimeofday() code.  Except 
that the system settime code is platform dependent, this solution is 
platform independent.

-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml


  reply	other threads:[~2003-03-21 19:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-21  0:16 Clock monotonic a suggestion 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
2003-03-21 20:53     ` john stultz
2003-03-21 13:17 ` Martin Waitz
2003-03-21 19:18   ` george anzinger [this message]
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=3E7B659F.9020407@mvista.com \
    --to=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tali@admingilde.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;
as well as URLs for NNTP newsgroup(s).