All of lore.kernel.org
 help / color / mirror / Atom feed
* What is the source of the time field in perf_sample events?
@ 2012-03-18 12:08 Bernie Pope
  2012-04-06 17:14 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Bernie Pope @ 2012-03-18 12:08 UTC (permalink / raw)
  To: linux-perf-users

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?

Regards,
Bernie.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: What is the source of the time field in perf_sample events?
  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
  0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2012-04-06 17:14 UTC (permalink / raw)
  To: Bernie Pope; +Cc: linux-perf-users

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-06 17:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.