Re: [PATCH 3/6] perf record: add time-of-day option

Peter Zijlstra
2011-03-01T22:26:44Z

On Tue, 2011-03-01 at 09:45 -0700, David Ahern wrote:

> One example would be a system watchdog that decided for some reason or
> another to force an event sample because of some event it detected.

That would be a design error, there already is an event, use that.

> >
> > I'd much rather expose the whole
> > local_clock()/perf_clock()/trace_clock() (should all be the same anyway)
> > as a posix clock using CLOCK_TRACING or whatever would be an appropriate
> > name.
> >
> > [ Since the whole thing is NMI safe it should be well possible to make a
> > VDSO version as well. ]
> >
> > Anyway, once its visible as a posix clock you can sync up from
> > userspace. And this clock is indeed wanted for other things too, like
> > user-space tracing etc.
> >
>
> And for some silly reason I sense a time trap here (pun intended) .....
>
> So your pushback is:
> 1. throw out the realtime-clock event patch,

Well, no, you need continues samples to keep in sync, so having this is
required [*].

> 2. add a new CLOCK_TRACING type to clock_gettime with VDSO hook,

Right, that is something we need anyway at some point in time.

> 3. and use a synthesized event from userspace for snapshotting
> perf_clock to time-of-day -- similar to what I have now, but one that
> will guarantee a time-of-day to perf_clock correlation (versus the
> current one which hopes that perf_clock is the monotonic clock).

I guess you could do that if we have full userspace tracing support, but
it wouldn't need synthesized events, it would need a pure userspace
event stream.

Thing is, I really dislike the ioctl() trigger