Messages in this thread | | | Date | Thu, 25 Sep 2008 18:27:37 -0700 | From | Jeremy Fitzhardinge <> | Subject | Re: [RFC PATCH 1/3] Unified trace buffer |
| |
Steven Rostedt wrote: > How do you get this GTOD read in the ring buffer? If the ring buffer does > it without any knowledge from the tracer, it may be doing it a > inappropriate times. This would also imply that the GTOD infrastructure > itself is reentrent safe. Imagine tracing the GTOD code when the buffer > decides it is about time to add the GTOD timestamp into the buffer. Can > the GTOD handle this recursion. If the GTOD has spinlocks, probably not. >
It doesn't need to read the GTOD synchronously when writing the trace record. When a tsc event occurs, it needs to store the GTOD/tsc/frequency somewhere at that point. When you next write a trace record, if that structure has been updated, you write it into the trace before emitting the next delta timestamp.
In fact you can read the GTOD at almost any time between tsc frequency updates, so you can defer it to whenever is convenient. At the time the tsc changes frequency, you emit: (tsc,frequency), and a bit later (before it changes again) you emit (tsc,GTOD). That allows you to retroactively compute GTODs for all timestamps. Obviously it would be good to get them as close as possible together.
J
| |