Re: [tip:perf/core] events: Rename TRACE_EVENT_TEMPLATE() toDECLARE_EVENT_CLASS()

From: Ingo Molnar
Date: Thu Nov 26 2009 - 13:12:28 EST



* Frederic Weisbecker <fweisbec@xxxxxxxxx> wrote:

> On Thu, Nov 26, 2009 at 09:45:30AM -0500, Steven Rostedt wrote:
> > On Thu, 2009-11-26 at 09:40 +0100, Ingo Molnar wrote:
> > > * Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> > >
> >
> > > > I would like to hear what others think about this change before we go
> > > > ahead and implement it.
> > >
> > > You mean TRACE_EVENT() -> DEFINE_SINGLE_EVENT()? Sure, we want todo it
> > > in a more quiet moment of the kernel cycle, not now.
> > >
> > > (TRACE_EVENT_TEMPLATE OTOH has existed for just a few days so it's not a
> > > problem.)
> >
> > Yes the template name is new, I'm not talking about that on
> > particularly.
>
> I personally don't mind much about the name, especially between class
> and template. Both make equally sense to me.
>
> But DECLARE sounds like a misnomer here (like DEFINE_EVENT somehow) as
> TRACE_EVENT, DEFINE_EVENT and TRACE_EVENT_TEMPLATE all behave either
> as a declaration or a definition, depending on the CREATE_TRACE_POINT
> macro.

DECLARE_EVENT_CLASS() doesnt really define an event visible to the user
yet though. It defines functions internally (to be used by the real
definition of the event) - but not visible externally really.

So the real 'definition' of an event happens with DEFINE_EVENT() - in
the logical model of this.

So the logical model is clear:

DECLARE_EVENT_CLASS(class);

DEFINE_EVENT(class, event1);
DEFINE_EVENT(class, event2);
DEFINE_EVENT(class, event3);
...

# later:
# DEFINE_STANDALONE_EVENT(event)

And the logical model is what matters: that's what developers will use.
They'll use these constructs based on the logical model, nobody sane
will look into the CPP magic ;-)

And yes, we occasionally have to revisit our naming choices - especially
when mistakes/misnomers become apparent.

Thanks,

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