linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: David Ahern <dsahern@gmail.com>
Cc: linux-kernel@vger.kernel.org, Pawel Moll <pawel.moll@arm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Mike Galbraith <efault@gmx.de>, Jiri Olsa <jolsa@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Stephane Eranian <eranian@google.com>,
	John Stultz <john.stultz@linaro.org>,
	Sonny Rao <sonnyrao@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] perf: POSIX CLOCK_PERF to report current time value
Date: Wed, 11 Dec 2013 12:40:04 +0100	[thread overview]
Message-ID: <20131211114004.GA789@gmail.com> (raw)
In-Reply-To: <20131211112526.GC25541@gmail.com>


* Ingo Molnar <mingo@kernel.org> wrote:

> 
> * David Ahern <dsahern@gmail.com> wrote:
> 
> > From: Pawel Moll <pawel.moll@arm.com>
> > 
> > To co-relate user space events with the perf events stream
> > a current (as in: "what time(stamp) is it now?") time value
> > must be made available.
> 
> So I'm wondering about your earlier approach posted here:
> 
>   https://lkml.org/lkml/2011/6/7/636
> 
> I'd modify that patch the following way: instead of tracking each 
> separate reason, perhaps only track timekeeping_update().
> 
> Such a tracepoint, combined with PERF_SAMPLE_TIME, would very 
> accurately track external changes to GTOD (xtime).
> 
> That leaves us with tracking/correlating the regular flow of time, 
> which could be achieved by another tracepoint in:
> 
>    kernel/time/timekeeping.c::do_timer()
> 
> So only two new tracepoints are needed AFAICS - and the tracepoints 
> would obviously be useful for other (debugging) purposes as well. 
> Would that solve the wall-clock correlation problem adequately?

I forgot to mention what data the new tracepoints would trace:

   - timekeeping_update() would trace the 'before' and 'after' 
     (==current) GTOD values

   - do_timer() would trace 'ticks' and the current GTOD value.

'GTOD value' is what gettimeofday() would return, which in the 
do_timer() case ought to be something like this:

   tk->xtime_sec
  (tk->xtime_nsec >> tk->shift) + get_arch_timeoffset()

(Note that this is simple and fast as there's no need to read the 
clock once again, it was just read.)

Thanks,

	Ingo

      reply	other threads:[~2013-12-11 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-10 20:27 [PATCH] perf: POSIX CLOCK_PERF to report current time value David Ahern
2013-12-10 20:44 ` John Stultz
2013-12-11 12:07   ` Ingo Molnar
2013-12-11 19:37     ` John Stultz
2013-12-11 11:25 ` Ingo Molnar
2013-12-11 11:40   ` Ingo Molnar [this message]

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=20131211114004.GA789@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=sonnyrao@chromium.org \
    --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 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).