Introduce API to remap event names exposed by LTTng
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 30 Mar 2013 00:38:18 +0000 (20:38 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 30 Mar 2013 00:38:18 +0000 (20:38 -0400)
Some kernel event providers don't follow naming hierarchy. Rename them
internally within LTTng.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
probes/define_trace.h
probes/lttng-events-reset.h
probes/lttng-events.h

index a518390b334bff6e20a912c9077c0aac6abddad6..96d80a5894d20a9c95697f9535b4d4e7746b3afb 100644 (file)
  */
 #include <linux/module.h>
 
+#undef TRACE_EVENT_MAP
+#define TRACE_EVENT_MAP(name, map, proto, args, tstruct, assign, print)        \
+       DEFINE_TRACE(name)
+
+#undef TRACE_EVENT_CONDITION_MAP
+#define TRACE_EVENT_CONDITION_MAP(name, map, proto, args, cond, tstruct, assign, print) \
+       TRACE_EVENT(name,                                               \
+               PARAMS(proto),                                          \
+               PARAMS(args),                                           \
+               PARAMS(tstruct),                                        \
+               PARAMS(assign),                                         \
+               PARAMS(print))
+
+#undef TRACE_EVENT_FN_MAP
+#define TRACE_EVENT_FN_MAP(name, map, proto, args, tstruct,            \
+               assign, print, reg, unreg)                      \
+       DEFINE_TRACE_FN(name, reg, unreg)
+
+#undef DEFINE_EVENT_MAP
+#define DEFINE_EVENT_MAP(template, name, map, proto, args) \
+       DEFINE_TRACE(name)
+
+#undef DEFINE_EVENT_PRINT_MAP
+#define DEFINE_EVENT_PRINT_MAP(template, name, map, proto, args, print)        \
+       DEFINE_TRACE(name)
+
+#undef DEFINE_EVENT_CONDITION_MAP
+#define DEFINE_EVENT_CONDITION_MAP(template, name, map, proto, args, cond) \
+       DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
+
+
 #undef TRACE_EVENT
 #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
        DEFINE_TRACE(name)
 #undef TRACE_EVENT
 #undef TRACE_EVENT_FN
 #undef TRACE_EVENT_CONDITION
-#undef DECLARE_EVENT_CLASS
 #undef DEFINE_EVENT
 #undef DEFINE_EVENT_PRINT
 #undef DEFINE_EVENT_CONDITION
+#undef TRACE_EVENT_MAP
+#undef TRACE_EVENT_FN_MAP
+#undef TRACE_EVENT_CONDITION_MAP
+#undef DECLARE_EVENT_CLASS
+#undef DEFINE_EVENT_MAP
+#undef DEFINE_EVENT_PRINT_MAP
+#undef DEFINE_EVENT_CONDITION_MAP
 #undef TRACE_HEADER_MULTI_READ
 
 /* Only undef what we defined in this file */
index 7355e1839b68e378c05574ce90fe9d656af5f1c5..44e8ba59b2456d5b8a3e1c9d841ce3ef694ccd5b 100644 (file)
 #undef DECLARE_EVENT_CLASS_NOARGS
 #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print)
 
-#undef DEFINE_EVENT
-#define DEFINE_EVENT(_template, _name, _proto, _args)
+#undef DEFINE_EVENT_MAP
+#define DEFINE_EVENT_MAP(_template, _name, _map, _proto, _args)
 
-#undef DEFINE_EVENT_NOARGS
-#define DEFINE_EVENT_NOARGS(_template, _name)
+#undef DEFINE_EVENT_MAP_NOARGS
+#define DEFINE_EVENT_MAP_NOARGS(_template, _name, _map)
 
 #undef TRACE_EVENT_FLAGS
 #define TRACE_EVENT_FLAGS(name, value)
index 33cabcf9c87bd886e6381adad21ae6bbfb39dcde..8a3a886b79dfac7ea561ad4b4f14cc04c42f124b 100644 (file)
  * Macro declarations used for all stages.
  */
 
+/*
+ * LTTng name mapping macros. LTTng remaps some of the kernel events to
+ * enforce name-spacing.
+ */
+#undef TRACE_EVENT_MAP
+#define TRACE_EVENT_MAP(name, map, proto, args, tstruct, assign, print)        \
+       DECLARE_EVENT_CLASS(map,                                        \
+                            PARAMS(proto),                             \
+                            PARAMS(args),                              \
+                            PARAMS(tstruct),                           \
+                            PARAMS(assign),                            \
+                            PARAMS(print))                             \
+       DEFINE_EVENT_MAP(map, name, map, PARAMS(proto), PARAMS(args))
+
+#undef TRACE_EVENT_MAP_NOARGS
+#define TRACE_EVENT_MAP_NOARGS(name, map, tstruct, assign, print)      \
+       DECLARE_EVENT_CLASS_NOARGS(map,                                 \
+                            PARAMS(tstruct),                           \
+                            PARAMS(assign),                            \
+                            PARAMS(print))                             \
+       DEFINE_EVENT_MAP_NOARGS(map, name, map)
+
+#undef DEFINE_EVENT_PRINT_MAP
+#define DEFINE_EVENT_PRINT_MAP(template, name, map, proto, args, print)        \
+       DEFINE_EVENT_MAP(template, name, map, PARAMS(proto), PARAMS(args))
+
+/* Callbacks are meaningless to LTTng. */
+#undef TRACE_EVENT_FN_MAP
+#define TRACE_EVENT_FN_MAP(name, map, proto, args, tstruct,            \
+               assign, print, reg, unreg)                              \
+       TRACE_EVENT_MAP(name, map, PARAMS(proto), PARAMS(args),         \
+               PARAMS(tstruct), PARAMS(assign), PARAMS(print))         \
+
+#undef TRACE_EVENT_CONDITION_MAP
+#define TRACE_EVENT_CONDITION_MAP(name, map, proto, args, cond, tstruct, assign, print) \
+       TRACE_EVENT_MAP(name, map,                                      \
+               PARAMS(proto),                                          \
+               PARAMS(args),                                           \
+               PARAMS(tstruct),                                        \
+               PARAMS(assign),                                         \
+               PARAMS(print))
+
 /*
  * DECLARE_EVENT_CLASS can be used to add a generic function
  * handlers for events. That is, if all events have the same
  */
 
 #undef TRACE_EVENT
-#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
-       DECLARE_EVENT_CLASS(name,                              \
-                            PARAMS(proto),                    \
-                            PARAMS(args),                     \
-                            PARAMS(tstruct),                  \
-                            PARAMS(assign),                   \
-                            PARAMS(print))                    \
-       DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args))
+#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
+       TRACE_EVENT_MAP(name, name,                             \
+                       PARAMS(proto),                          \
+                       PARAMS(args),                           \
+                       PARAMS(tstruct),                        \
+                       PARAMS(assign),                         \
+                       PARAMS(print))
 
 #undef TRACE_EVENT_NOARGS
-#define TRACE_EVENT_NOARGS(name, tstruct, assign, print)       \
-       DECLARE_EVENT_CLASS_NOARGS(name,                       \
-                            PARAMS(tstruct),                  \
-                            PARAMS(assign),                   \
-                            PARAMS(print))                    \
-       DEFINE_EVENT_NOARGS(name, name)
-
+#define TRACE_EVENT_NOARGS(name, tstruct, assign, print)       \
+       TRACE_EVENT_MAP_NOARGS(name, name,                      \
+                       PARAMS(tstruct),                        \
+                       PARAMS(assign),                         \
+                       PARAMS(print))
 
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
-       DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
+       DEFINE_EVENT_PRINT_MAP(template, name, name,            \
+                       PARAMS(proto), PARAMS(args), PARAMS(print_))
 
-/* Callbacks are meaningless to LTTng. */
 #undef TRACE_EVENT_FN
 #define TRACE_EVENT_FN(name, proto, args, tstruct,                     \
                assign, print, reg, unreg)                              \
-       TRACE_EVENT(name, PARAMS(proto), PARAMS(args),                  \
-               PARAMS(tstruct), PARAMS(assign), PARAMS(print))         \
+       TRACE_EVENT_FN_MAP(name, name, PARAMS(proto), PARAMS(args),     \
+               PARAMS(tstruct), PARAMS(assign), PARAMS(print),         \
+               PARAMS(reg), PARAMS(unreg))                             \
+
+#undef DEFINE_EVENT
+#define DEFINE_EVENT(template, name, proto, args)                      \
+       DEFINE_EVENT_MAP(template, name, name, PARAMS(proto), PARAMS(args))
+
+#undef DEFINE_EVENT_NOARGS
+#define DEFINE_EVENT_NOARGS(template, name)                            \
+       DEFINE_EVENT_MAP_NOARGS(template, name, name)
+
+#undef TRACE_EVENT_CONDITION
+#define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \
+       TRACE_EVENT_CONDITION_MAP(name, name,                           \
+               PARAMS(proto),                                          \
+               PARAMS(args),                                           \
+               PARAMS(cond),                                           \
+               PARAMS(tstruct),                                        \
+               PARAMS(assign),                                         \
+               PARAMS(print))
 
 /*
  * Stage 1 of the trace events.
 #undef TP_ARGS
 #define TP_ARGS(args...) args
 
-#undef DEFINE_EVENT
-#define DEFINE_EVENT(_template, _name, _proto, _args)                  \
+#undef DEFINE_EVENT_MAP
+#define DEFINE_EVENT_MAP(_template, _name, _map, _proto, _args)                \
 void trace_##_name(_proto);
 
-#undef DEFINE_EVENT_NOARGS
-#define DEFINE_EVENT_NOARGS(_template, _name)                          \
+#undef DEFINE_EVENT_MAP_NOARGS
+#define DEFINE_EVENT_MAP_NOARGS(_template, _name, _map)                        \
 void trace_##_name(void *__data);
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
@@ -256,19 +314,19 @@ static void __event_probe__##_name(void *__data);
 #define TP_PROBE_CB(_template) &__event_probe__##_template
 #endif
 
-#undef DEFINE_EVENT_NOARGS
-#define DEFINE_EVENT_NOARGS(_template, _name)                          \
-static const struct lttng_event_desc __event_desc___##_name = {                \
+#undef DEFINE_EVENT_MAP_NOARGS
+#define DEFINE_EVENT_MAP_NOARGS(_template, _name, _map)                        \
+static const struct lttng_event_desc __event_desc___##_map = {         \
        .fields = __event_fields___##_template,                         \
-       .name = #_name,                                                 \
+       .name = #_map,                                                  \
        .probe_callback = (void *) TP_PROBE_CB(_template),              \
        .nr_fields = ARRAY_SIZE(__event_fields___##_template),          \
        .owner = THIS_MODULE,                                           \
 };
 
-#undef DEFINE_EVENT
-#define DEFINE_EVENT(_template, _name, _proto, _args)                  \
-       DEFINE_EVENT_NOARGS(_template, _name)
+#undef DEFINE_EVENT_MAP
+#define DEFINE_EVENT_MAP(_template, _name, _map, _proto, _args)                \
+       DEFINE_EVENT_MAP_NOARGS(_template, _name, _map)
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
@@ -283,13 +341,13 @@ static const struct lttng_event_desc __event_desc___##_name = {           \
 
 #include "lttng-events-reset.h"        /* Reset all macros within TRACE_EVENT */
 
-#undef DEFINE_EVENT_NOARGS
-#define DEFINE_EVENT_NOARGS(_template, _name)                                 \
-               &__event_desc___##_name,
+#undef DEFINE_EVENT_MAP_NOARGS
+#define DEFINE_EVENT_MAP_NOARGS(_template, _name, _map)                               \
+               &__event_desc___##_map,
 
-#undef DEFINE_EVENT
-#define DEFINE_EVENT(_template, _name, _proto, _args)                         \
-       DEFINE_EVENT_NOARGS(_template, _name)
+#undef DEFINE_EVENT_MAP
+#define DEFINE_EVENT_MAP(_template, _name, _map, _proto, _args)                       \
+       DEFINE_EVENT_MAP_NOARGS(_template, _name, _map)
 
 #define TP_ID1(_token, _system)        _token##_system
 #define TP_ID(_token, _system) TP_ID1(_token, _system)
This page took 0.031838 seconds and 4 git commands to generate.