Re: [PATCH][tip/perf/core] tracing: Rename TRACE_EVENT and othersto something resonable

From: Frederic Weisbecker
Date: Wed Dec 02 2009 - 15:16:45 EST


On Wed, Dec 02, 2009 at 03:11:23PM -0500, Steven Rostedt wrote:
> With the addition of TRACE_EVENT templates (or classes) the issue of
> naming has come up.
>
> Originally, the template was called TRACE_EVENT_TEMPLATE. This was to be
> used to consolidate similar TRACE_EVENTs because a single TRACE_EVENT
> takes up quite a bit of code. One TRACE_EVENT creates a function to
> register and unregister a trace point, a function to record the event in
> a buffer, a function to display the binary output to user space, a
> function to add counters to record the number of times the event is
> reached, and so on.
>
> All these functions creates a lot of bloat, especially since these
> functions are almost identical to each other. Unfortunately, these
> functions require specific parameters and structure fields, and can't
> always be the same. But for those events that share the same structure
> and parameters, a class/template allows them to share the same functions
> and this cuts down the bloat substantially.
>
> But what to call these macros to satisfy the already confused kernel
> developers?
>
> Ideally, DECLARE_EVENT_CLASS to create the class, DEFINE_EVENT to create
> an instance of the class, and even DEFINE_EVENT_CLASS to replace the
> current TRACE_EVENT that defines a class and creates an event of the
> same name as the class. New DEFINE_EVENTs may also reference a class
> declared by DEFINE_EVENT_CLASS.
>
> But us kernel developers stay up too late at night, drinking jolt (or
> beer if you are in Europe), and our brain cells have fused to only
> logical circuitry, thus understanding concepts that are not engraved in
> stone becomes a bit too straining for us, and we may finally have to
> give up on solving this one last bug to get some rest with our love one
> that's been sleeping since 9pm.
>
> This means using DECLARE_* and DEFINE_* will push us over that brink to
> normalcy and must be avoided. A new name must be established to clearly
> describe the mystical CPP magic that comprises the TRACE_EVENT hackery.
> Something that can bring us back to our roots. Something where it all
> begins. The stone age.
>
> Thus, this patch renames the MACROS to the most obvious definitions
> around. Something we should have thought of at the start.
>
>
> s/DEFINE_EVENT_CLASS/FRED/g
> s/DEFINE_EVENT/WILMA/g
> s/TRACE_EVENT/BARNEY/g
>
>
> Thus with the new naming convention:
>
> FRED(x, ...) -- will declare a class but will not make any events
> WILMA(x, y, ...) -- will create an event based off of class made by FRED
> BARNEY(x, ...) -- will create both a class and an event
>
> /* Little known secret, WILMA can also fool around with BARNEY and can
> create new events with BARNEY as well as with FRED */
>
> (apologies to Thomas Gleixner and his renaming to "fred")
>
> Signed-off-by: Steven Rostedt <flintstone@xxxxxxxxxxx>


Acked-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>

--
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/