X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=include%2Flttng%2Ftracepoint-event-impl.h;h=fdc3d5cf13be5c5ed430e1740c7034b14bfd606a;hb=860c213b645593fa19d7a3abf7ffdd1282f0a1c6;hp=32ecf29d81765c24bd65ead03a6e03871e9d3bce;hpb=9857164a67f1a037f96011acbb2d533025d5221f;p=lttng-modules.git diff --git a/include/lttng/tracepoint-event-impl.h b/include/lttng/tracepoint-event-impl.h index 32ecf29d..fdc3d5cf 100644 --- a/include/lttng/tracepoint-event-impl.h +++ b/include/lttng/tracepoint-event-impl.h @@ -208,6 +208,42 @@ void __event_template_proto___##_name(void); #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) +/* + * Stage 1.3 of the trace events. + * + * Create probe callback prototypes. + */ + +/* Reset all macros within TRACEPOINT_EVENT */ +#include + +#undef TP_PROTO +#define TP_PROTO(...) __VA_ARGS__ + +#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \ +static void __event_probe__##_name(void *__data, _proto); + +#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS +#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \ +static void __event_probe__##_name(void *__data); + +#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) + +/* + * Stage 1.4 of tracepoint event generation. + * + * Declare toplevel descriptor for the whole probe. + */ + +#define TP_ID1(_token, _system) _token##_system +#define TP_ID(_token, _system) TP_ID1(_token, _system) + +static __used struct lttng_kernel_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM); + +#undef TP_ID1 +#undef TP_ID + /* * Stage 2 of the trace events. * @@ -299,10 +335,20 @@ void __event_template_proto___##_name(void); #undef TP_FIELDS #define TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */ +#ifndef TP_PROBE_CB +#define TP_PROBE_CB(_template) &__event_probe__##_template +#endif + #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \ static const struct lttng_kernel_event_field *__event_fields___##_name[] = { \ _fields \ + }; \ + static const struct lttng_kernel_tracepoint_class lttng_kernel__event_class___##_name = { \ + .fields = __event_fields___##_name, \ + .nr_fields = ARRAY_SIZE(__event_fields___##_name), \ + .probe_callback = (void (*)(void)) TP_PROBE_CB(_name), \ + .probe_desc = &TP_ID(__probe_desc___, TRACE_SYSTEM), \ }; #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE @@ -332,35 +378,20 @@ void __event_template_proto___##_name(void); .name = #_name, \ .entries = __enum_values__##_name, \ .nr_entries = ARRAY_SIZE(__enum_values__##_name), \ + .probe_desc = &TP_ID(__probe_desc___, TRACE_SYSTEM), \ })) +#define TP_ID1(_token, _system) _token##_system +#define TP_ID(_token, _system) TP_ID1(_token, _system) + #define LTTNG_CREATE_FIELD_METADATA #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) #undef LTTNG_CREATE_FIELD_METADATA #undef LTTNG_TRACEPOINT_TYPE_VISIBILITY -/* - * Stage 3 of the trace events. - * - * Create probe callback prototypes. - */ - -/* Reset all macros within TRACEPOINT_EVENT */ -#include - -#undef TP_PROTO -#define TP_PROTO(...) __VA_ARGS__ - -#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \ -static void __event_probe__##_name(void *__data, _proto); - -#undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS -#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \ -static void __event_probe__##_name(void *__data); - -#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) +#undef TP_ID1 +#undef TP_ID /* * Stage 4 of the trace events. @@ -1043,15 +1074,15 @@ static void __event_probe__##_name(_data_proto) \ { \ struct lttng_kernel_event_recorder *__event_recorder = \ container_of(__event, struct lttng_kernel_event_recorder, parent); \ - struct lttng_channel *__chan = __event_recorder->chan; \ - struct lttng_kernel_session *__session = __chan->session; \ + struct lttng_kernel_channel_buffer *__chan = __event_recorder->chan; \ + struct lttng_kernel_session *__session = __chan->parent.session; \ struct lttng_kernel_id_tracker_rcu *__lf; \ \ if (!_TP_SESSION_CHECK(session, __session)) \ return; \ if (unlikely(!LTTNG_READ_ONCE(__session->active))) \ return; \ - if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \ + if (unlikely(!LTTNG_READ_ONCE(__chan->parent.enabled))) \ return; \ __lf = lttng_rcu_dereference(__session->pid_tracker.p); \ if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \ @@ -1100,7 +1131,7 @@ static void __event_probe__##_name(_data_proto) \ { \ struct lttng_kernel_event_recorder *__event_recorder = \ container_of(__event, struct lttng_kernel_event_recorder, parent); \ - struct lttng_channel *__chan = __event_recorder->chan; \ + struct lttng_kernel_channel_buffer *__chan = __event_recorder->chan; \ struct lttng_kernel_ring_buffer_ctx __ctx; \ ssize_t __event_len; \ size_t __event_align; \ @@ -1108,7 +1139,7 @@ static void __event_probe__##_name(_data_proto) \ \ __event_len = __event_get_size__##_name(_locvar_args); \ if (unlikely(__event_len < 0)) { \ - lib_ring_buffer_lost_event_too_big(__chan->chan); \ + __chan->ops->lost_event_too_big(__chan); \ goto __post; \ } \ __event_align = __event_get_align__##_name(_locvar_args); \ @@ -1164,7 +1195,7 @@ __post: \ #undef __get_dynamic_len /* - * Stage 7 of the trace events. + * Stage 7.1 of the trace events. * * Create event descriptions. */ @@ -1173,18 +1204,13 @@ __post: \ #include /* Reset all macros within LTTNG_TRACEPOINT_EVENT */ -#ifndef TP_PROBE_CB -#define TP_PROBE_CB(_template) &__event_probe__##_template -#endif - #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \ static const struct lttng_kernel_event_desc __event_desc___##_map = { \ .event_name = #_map, \ .event_kname = #_name, \ - .probe_callback = (void (*)(void)) TP_PROBE_CB(_template), \ - .fields = __event_fields___##_template, \ - .nr_fields = ARRAY_SIZE(__event_fields___##_template), \ + .tp_class = <tng_kernel__event_class___##_template, \ + .probe_desc = &TP_ID(__probe_desc___, TRACE_SYSTEM), \ .owner = THIS_MODULE, \ }; @@ -1192,8 +1218,14 @@ static const struct lttng_kernel_event_desc __event_desc___##_map = { \ #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) +#define TP_ID1(_token, _system) _token##_system +#define TP_ID(_token, _system) TP_ID1(_token, _system) + #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) +#undef TP_ID1 +#undef TP_ID + /* * Stage 8 of the trace events. *