public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Lameter <christoph@lameter.com>
To: linux-ia64@vger.kernel.org
Subject: Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized
Date: Fri, 04 Jun 2004 15:06:57 +0000	[thread overview]
Message-ID: <Pine.LNX.4.58.0406040804120.16070@server.home> (raw)
In-Reply-To: <Pine.LNX.4.58.0406031313420.32412@server.home>

On Fri, 4 Jun 2004, Ulrich Drepper wrote:

> Christoph Lameter wrote:
>
> > clock_gettime(CLOCK_REALTIME) calls gettimeofday internally and then
> > multiplies with 1000.
>
> Internally where?  clock_gettime is a syscall.  And it can use whatever
> functionality the kernel provides.  There is absolutely no requirement
> to add additional clocks, just make clock_gettime do the right think if
> this isn't happening already.

Internally in the kernel. Excerpts from kernel/posix-timers.c:

static int do_posix_gettime(struct k_clock *clock, struct timespec *tp)
{
        struct timeval tv;

        if (clock->clock_get)
                return clock->clock_get(tp);

        do_gettimeofday(&tv);
        tp->tv_sec = tv.tv_sec;
        tp->tv_nsec = tv.tv_usec * NSEC_PER_USEC;

        return 0;
}

static u64 do_posix_clock_monotonic_gettime_parts(
        struct timespec *tp, struct timespec *mo)
{
        u64 jiff;
        struct timeval tpv;
        unsigned int seq;

        do {
                seq = read_seqbegin(&xtime_lock);
                do_gettimeofday(&tpv);
                *mo = wall_to_monotonic;
                jiff = jiffies_64;

        } while(read_seqretry(&xtime_lock, seq));

        /*
         * Love to get this before it is converted to usec.
         * It would save a div AND a mpy.
         */
        tp->tv_sec = tpv.tv_sec;
        tp->tv_nsec = tpv.tv_usec * NSEC_PER_USEC;

        return jiff;
}



  parent reply	other threads:[~2004-06-04 15:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
2004-06-03 20:51 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized Andreas Schwab
2004-06-03 21:21 ` Christoph Lameter
2004-06-03 21:52 ` Andreas Schwab
2004-06-04  6:04 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC David Mosberger
2004-06-04  6:12 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized Ulrich Drepper
2004-06-04  6:58 ` David Mosberger
2004-06-04 14:29 ` Christoph Lameter
2004-06-04 15:06 ` Christoph Lameter [this message]
2004-06-04 22:06 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Peter Chubb
2004-06-04 22:25 ` Luck, Tony

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.58.0406040804120.16070@server.home \
    --to=christoph@lameter.com \
    --cc=linux-ia64@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