lkml.org 
[lkml]   [2010]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/9 - v2][RFC] tracing: Let tracepoints have data passed to tracepoint callbacks
On Fri, May 07, 2010 at 10:09:31AM -0400, Steven Rostedt wrote:
> > > +#define DECLARE_TRACE(name, proto, args) \
> > > + __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
> > > + PARAMS(proto, void *__data), \
> > > + PARAMS(args, __data))
> > >
> > > #define DEFINE_TRACE_FN(name, reg, unreg) \
> > > static const char __tpstrtab_##name[] \
> > > @@ -100,19 +133,37 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
> > > struct tracepoint *end);
> > >
> > > #else /* !CONFIG_TRACEPOINTS */
> > > -#define DECLARE_TRACE(name, proto, args) \
> > > - static inline void _do_trace_##name(struct tracepoint *tp, proto) \
> > > - { } \
> > > +#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \
> > > static inline void trace_##name(proto) \
> > > - { } \
> > > + { \
> > > + } \
> > > static inline int register_trace_##name(void (*probe)(proto)) \
> > > { \
> > > return -ENOSYS; \
> > > } \
> > > - static inline int unregister_trace_##name(void (*probe)(proto)) \
> > > + static inline int unregister_trace_##name(void (*probe)(proto)) \
> > > + { \
> > > + return -ENOSYS; \
> > > + } \
> > > + static inline int \
> > > + register_trace_##name##_data(void (*probe)(data_proto), \
> > > + void *data) \
> > > + { \
> > > + return -ENOSYS; \
> > > + } \
> > > + static inline int \
> > > + unregister_trace_##name##_data(void (*probe)(data_proto), \
> > > + void *data) \
> > > { \
> > > return -ENOSYS; \
> > > }
> > > +#define DECLARE_TRACE_NOARGS(name) \
> > > + __DECLARE_TRACE(name, void, , void *__data, __data)
> > > +
> > > +#define DECLARE_TRACE(name, proto, args) \
> > > + __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
> > > + PARAMS(proto, void *__data), \
> > > + PARAMS(args, __data))
> >
> >
> >
> >
> > It seems that the on and off cases are exactly the same for DECLARE_TRACE*(),
> > you could provide a single version and let the __DECLARE_TRACE() do
> > the on/off trick.
>
>
> I don't know what you mean here. How would __DECLARE_TRACE() do what
> both DECLARE_TRACE() and DECLARE_TRACE_NOARGS() do? It will fail the
> compile if proto is "void".



No, what I meant is that you have:

#ifdef CONFIG_TRACEPOINTS
[...]
+#define DECLARE_TRACE_NOARGS(name) \
__DECLARE_TRACE(name, void, , void *__data, __data)

#define DECLARE_TRACE(name, proto, args) \
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
PARAMS(proto, void *__data), \
PARAMS(args, __data))
[...]
#else
[...]
+#define DECLARE_TRACE_NOARGS(name) \
__DECLARE_TRACE(name, void, , void *__data, __data)

#define DECLARE_TRACE(name, proto, args) \
__DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
PARAMS(proto, void *__data), \
PARAMS(args, __data)
[...]
#endif


See? They seem to be the exact same version, so this could be only
one version outside the ifdef.
And the CONFIG_TRACEPOINTS on/off case is dealt from __DECLARE_TRACE().



\
 
 \ /
  Last update: 2010-05-07 20:09    [W:0.088 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site