Add lttng irq probe support
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 16 Dec 2010 03:45:40 +0000 (22:45 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 16 Dec 2010 03:45:40 +0000 (22:45 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
probes/Makefile
probes/lttng-events.h
probes/lttng-probe-irq.c [new file with mode: 0644]

index 1c4f32b8bca2c9804ea04d7f30af6e07ce555947..29e114c8994b92c17d51b543b4cdef7061c4ea1c 100644 (file)
@@ -10,6 +10,7 @@ obj-m += lttng-types.o
 
 obj-m += lttng-probe-sched.o
 obj-m += lttng-probe-kvm.o
+obj-m += lttng-probe-irq.o
 
 endif
 
index aef811cd5c775861730f373f43aad73fe28153eb..c5eeac28cbf8aea5fba345dbabcc3c73195cd2e3 100644 (file)
@@ -26,6 +26,8 @@
 
 #endif //0
 
+/* TODO : deal with DEFINE_EVENT vs event class */
+
 struct lttng_event_field {
        const char *name;
        const struct lttng_type type;
@@ -117,7 +119,7 @@ struct lttng_event_desc {
 #undef __string
 #define __string(_item, _src)                                  \
        {                                                       \
-               .name = _item,                                  \
+               .name = #_item,                                 \
                .type = {                                       \
                  .atype = atype_string,                        \
                  .name = NULL,                                 \
@@ -129,9 +131,9 @@ struct lttng_event_desc {
 #define TP_STRUCT__entry(args...) args /* Only one used in this phase */
 
 #undef DECLARE_EVENT_CLASS
-#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print)   \
-       static const struct lttng_event_field __event_fields___##_name[] = {    \
-               _tstruct                                                        \
+#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
+       static const struct lttng_event_field __event_fields___##_name[] = { \
+               _tstruct                                                     \
        };
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
@@ -147,11 +149,11 @@ struct lttng_event_desc {
 #include "lttng-events-reset.h"        /* Reset all macros within TRACE_EVENT */
 
 #undef DECLARE_EVENT_CLASS
-#define DECLARE_EVENT_CLASS(_name, proto, args, tstruct, assign, print)        \
-               {                                                       \
-                       .fields = __event_fields___##_name,             \
-                       .name = #_name,                                 \
-                       .nr_fields = ARRAY_SIZE(__event_fields___##_name), \
+#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
+               {                                                            \
+                       .fields = __event_fields___##_name,                  \
+                       .name = #_name,                                      \
+                       .nr_fields = ARRAY_SIZE(__event_fields___##_name),   \
                },
 
 #define TP_ID1(_token, _system)        _token##_system
@@ -299,43 +301,46 @@ module_exit_eval(__lttng_types_exit__, TRACE_SYSTEM);
 /* Named field types must be defined in lttng-types.h */
 
 #undef __field
-#define __field(_type, _item)                                          \
-       len += lib_ring_buffer_align(len, sizeof(_type));               \
-       len += sizeof(_type);
+#define __field(_type, _item)                                            \
+       __event_len += lib_ring_buffer_align(__event_len, sizeof(_type)); \
+       __event_len += sizeof(_type);
 
 #undef __field_ext
 #define __field_ext(_type, _item, _filter_type)        __field(_type, _item)
 
 #undef __array
-#define __array(_type, _item, _length)                                 \
-       len += lib_ring_buffer_align(len, sizeof(_type));               \
-       len += sizeof(_type) * (_length);
+#define __array(_type, _item, _length)                                   \
+       __event_len += lib_ring_buffer_align(__event_len, sizeof(_type)); \
+       __event_len += sizeof(_type) * (_length);
 
 #undef __dynamic_array
-#define __dynamic_array(_type, _item, _length)                         \
-       len += lib_ring_buffer_align(len, sizeof(u32));                 \
-       len += sizeof(u32);                                             \
-       len += lib_ring_buffer_align(len, sizeof(_type));               \
-       len += sizeof(_type) * (_length);
+#define __dynamic_array(_type, _item, _length)                           \
+       __event_len += lib_ring_buffer_align(__event_len, sizeof(u32));   \
+       __event_len += sizeof(u32);                                       \
+       __event_len += lib_ring_buffer_align(__event_len, sizeof(_type)); \
+       __event_len += sizeof(_type) * (_length);
 
 #undef __string
 #define __string(_item, _src)                                          \
-       len += dynamic_len[dynamic_len_idx++] = strlen(_src) + 1;
+       __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1;
+
+#undef TP_PROTO
+#define TP_PROTO(args...) args
 
 #undef TP_STRUCT__entry
-#define TP_STRUCT__entry(args...) args /* Only one used in this phase */
+#define TP_STRUCT__entry(args...) args
 
 #undef DECLARE_EVENT_CLASS
-#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \
-static inline size_t __event_get_size__##name(size_t *dynamic_len)     \
-{                                                                      \
-       size_t len = 0;                                                 \
-       unsigned int dynamic_len_idx = 0;                               \
-                                                                       \
-       if (0)                                                          \
-               (void) dynamic_len_idx; /* don't warn if unused */      \
-       tstruct                                                         \
-       return len;                                                     \
+#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print)  \
+static inline size_t __event_get_size__##_name(size_t *__dynamic_len, _proto) \
+{                                                                            \
+       size_t __event_len = 0;                                               \
+       unsigned int __dynamic_len_idx = 0;                                   \
+                                                                             \
+       if (0)                                                                \
+               (void) __dynamic_len_idx;       /* don't warn if unused */    \
+       _tstruct                                                              \
+       return __event_len;                                                   \
 }
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
diff --git a/probes/lttng-probe-irq.c b/probes/lttng-probe-irq.c
new file mode 100644 (file)
index 0000000..e61fbb8
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * probes/lttng-probe-irq.c
+ *
+ * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * LTTng irq probes.
+ */
+
+#include <linux/module.h>
+
+/*
+ * Create LTTng tracepoint probes.
+ */
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#undef CONFIG_EVENT_TRACING    /* Don't create Ftrace probes */
+
+#include <trace/events/irq.h>
+
+MODULE_LICENSE("GPL and additional rights");
+MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
+MODULE_DESCRIPTION("LTTng irq probes");
This page took 0.029759 seconds and 4 git commands to generate.