Re: [RFC] perf: need to expose sched_clock to correlate usersamples with kernel samples

From: Peter Zijlstra
Date: Wed Feb 20 2013 - 05:29:43 EST

On Tue, 2013-02-19 at 10:25 -0800, John Stultz wrote:
> So describe how the perf time domain is different then

The primary difference is that the trace/sched/perf time domain is not
strictly monotonic, it is only locally monotonic -- that is two time
stamps taken on the same cpu are guaranteed to be monotonic.

Furthermore, to make it useful, there's an actual bound on the inter-cpu
drift (implemented by limiting the drift to CLOCK_MONOTONIC).

Additionally -- to increase use -- we also added a monotonic sync point
when cpu A queries time of cpu B.

> My concern here is that we're basically creating a kernel interface
> that
> exports implementation-defined semantics (again: whatever perf does
> right now). And I think folks want to do this, because adding
> is easier then trying to:
> 1) Get a lock-free method for accessing CLOCK_MONOTONIC_RAW
> 2) Having perf interpolate its timestamps to CLOCK_MONOTONIC, or
> CLOCKMONOTONIC_RAW when it exports the data

Mostly cheaper, not easier. Given unstable TSC, MONOTONIC will have to
fall back to another clock source (hpet, acpi_pm and other assorted

In order to avoid this, we'd had to relax the requirements. Using
anything other than TSC is simply not an option.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at