Re: [RFC patch 15/15] LTTng timestamp x86

Ingo Molnar
2008-10-18T17:50:42Z

* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> And if you make all these linear interpolations be per-CPU (so you
> have per-CPU offsets and frequencies) you never _ever_ need to touch
> any shared data at all, and you know you can scale basically
> perfectly.
>
> Your linear interpolations may not be _perfect_, but you'll be able to
> get them pretty damn near. In fact, even if the TSC's aren't
> synchronized at all, if they are at least _individually_ stable (just
> running at slightly different frequencies because they are in
> different clock domains, and/or at different start points), you can
> basically perfect the precision over time.

there's been code submitted by Michael Davidson recently that looked
interesting, which turns the TSC into such an entity:

http://lkml.org/lkml/2008/9/25/451

The periodic synchronization uses the hpet, but it thus allows lockless
and globally correct readouts of the TSC .

And that would match the long term goal as well: the hw should do this
all automatically. So perhaps we should have a trace_clock() after all,
independent of sched_clock(), and derived straight from RDTSC.

The approach as propoed has a couple of practical problems, but if we
could be one RDTSC+multiplication away from a pretty good timestamp that
would be rather useful, very fast and very robust ...

Ingo