linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Bernie Pope <bjpope@unimelb.edu.au>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: What is the source of the time field in perf_sample events?
Date: Fri, 06 Apr 2012 11:14:44 -0600	[thread overview]
Message-ID: <4F7F2484.2020307@gmail.com> (raw)
In-Reply-To: <B76DE0C2-3A2B-4D77-BBA2-9157891B222D@unimelb.edu.au>

On 3/18/12 6:08 AM, Bernie Pope wrote:
> Hello,
>
> I'm writing a tool to parse the perf.data output of perf and was wondering about the source of the timestamps found in perf_sample events? Specifically I mean the u64 time field in the perf_sample struct in util/event.h. I believe it is in nanoseconds from a particular event (system start?), but I can't find any documentation about where the time comes from.
>
> I'm also interested in reading from this time source from a userspace program, is that possible?

Did you get a response to this?

Code wise, you'll need to follow perf_clock(). I believe for x86 with a 
stable TSC you end up in native_sched_clock() in arch/x86/kernel/tsc.c.

As for the corresponding userspace call I believe it is 
clock_gettime(CLOCK_MONOTONIC, ...).

David

      reply	other threads:[~2012-04-06 17:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-18 12:08 What is the source of the time field in perf_sample events? Bernie Pope
2012-04-06 17:14 ` David Ahern [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=4F7F2484.2020307@gmail.com \
    --to=dsahern@gmail.com \
    --cc=bjpope@unimelb.edu.au \
    --cc=linux-perf-users@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;
as well as URLs for NNTP newsgroup(s).