All of lore.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Daniel Walker <dwalker@fifo99.com>
Subject: Re: [patch 11/14] timekeeper read clock helper functions
Date: Thu, 13 Aug 2009 16:30:18 -0700	[thread overview]
Message-ID: <1250206218.7149.13.camel@localhost.localdomain> (raw)
In-Reply-To: <20090813154201.810817188@de.ibm.com>>

On Thu, 2009-08-13 at 17:40 +0200, Martin Schwidefsky wrote:
> plain text document attachment (timekeeper-helper.diff)
> From: Martin Schwidefsky <schwidefsky@de.ibm.com>
> 
> Add timekeeper_read_clock_ntp and timekeeper_read_clock_raw and use
> them for getnstimeofday, ktime_get, ktime_get_ts and getrawmonotonic.
> 
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: john stultz <johnstul@us.ibm.com>
> Cc: Daniel Walker <dwalker@fifo99.com>
> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
> ---
>  kernel/time/timekeeping.c |   91 +++++++++++++++++++---------------------------
>  1 file changed, 38 insertions(+), 53 deletions(-)
> 
> Index: linux-2.6/kernel/time/timekeeping.c
> ===================================================================
> --- linux-2.6.orig/kernel/time/timekeeping.c
> +++ linux-2.6/kernel/time/timekeeping.c
> @@ -95,6 +95,40 @@ static void timekeeper_setup_internals(s
>  	timekeeper.mult = clock->mult;
>  }
> 
> +/* Timekeeper helper functions. */
> +static inline s64 timekeeping_get_ns(void)
> +{
> +	cycle_t cycle_now, cycle_delta;
> +	struct clocksource *clock;
> +
> +	/* read clocksource: */
> +	clock = timekeeper.clock;
> +	cycle_now = clock->read(clock);
> +
> +	/* calculate the delta since the last update_wall_time: */
> +	cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
> +
> +	/* return delta convert to nanoseconds using ntp adjusted mult. */
> +	return clocksource_cyc2ns(cycle_delta, timekeeper.mult,
> +				  timekeeper.shift);
> +}

Again, not a huge issue, but if we kept the read() out of this function
and instead passed the cycle_now value in as a argument, we could also
use this function in  timekeeping_forward_now()


thanks
-john



  parent reply	other threads:[~2009-08-13 23:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090813154034.613706651@de.ibm.com>
     [not found] ` <20090813154159.634291990@de.ibm.com>
2009-08-13 22:14   ` [patch 02/14] remove clocksource inline functions john stultz
2009-08-14  8:10     ` Martin Schwidefsky
2009-08-14  8:17       ` Thomas Gleixner
     [not found] ` <20090813154201.810817188@de.ibm.com>
2009-08-13 23:30   ` john stultz [this message]
2009-08-14 11:12     ` [patch 11/14] timekeeper read clock helper functions Martin Schwidefsky
2009-08-14  0:28 ` [patch 00/14] clocksource / timekeeping rework V3 john stultz

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=1250206218.7149.13.camel@localhost.localdomain \
    --to=johnstul@us.ibm.com \
    --cc=dwalker@fifo99.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=schwidefsky@de.ibm.com \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.