Re: [RFC PATCH 1/3] Unified trace buffer

From: Linus Torvalds
Date: Wed Sep 24 2008 - 13:34:20 EST




On Wed, 24 Sep 2008, Steven Rostedt wrote:
>
> The event counter is just the timestamp (quick patch, simple to fix). The
> term "counter" was bad. It should have been timestamp, which one would
> want a 64bit timestamp.

One definitely would _not_ want the full 64-bit timestamp.

There are two cases:

- lots and lots of events

just do a 32 bit "timestamp delta" to the previous packet (where the
first packet in the queue would be a delta from a value in the queue
header - and we can obviously make that value be the TSC so that the
first delta is always zero, but it may also make sense to make it a
real delta, and the queue header would contain some good
synchronization point value).

- occasional events

Oops. The delta wouldn't fit. So create a new "timestamp update" packet
with a 64-bit thing when doing the reservation. There's obviously no
cost issue (since this would only happen for things where there was a
multi-second delay - or at least an appreciable fraction of a delay -
between events)

This definitely is worth doing. If we have small trace objects (and many
things really do have pretty small traces), using just a 32-bit TSC not
only saves 4 bytes per trace event, but it makes it quite reasonable to
keep the trace data 4-byte-aligned rather than requiring 8-byte alignment.

Of course, if the traces end up being horribly bloated, none of that will
matter. But I really would hope that you we keep the header itself to just
8 bytes (and being 2 4-byte entities), so that small payloads are
reasonable. And that looks doable, if you have a 16-bit "type" and a
16-bit "size" field.

One thing I'd like to do is to also architecturally reserve a few of the
types for internal queue management stuff. Things like "padding" objects
(or a "end-of-ringbuffer" object), and the TSC overflow object, and a
"time sync" object (or heartbeat). So maybe the type would have the high
bit set as a "reserved for internal ringbuffer use" or whatever.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/