Tracepoints: Introduce DEFINE/DECLARE_TRACEPOINT, TRACEPOINT_EVENT...
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 22 Apr 2011 18:22:44 +0000 (14:22 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 22 Apr 2011 18:22:44 +0000 (14:22 -0400)
* Instrumentation API change *

Introduce the upcoming "TRACEPOINT_EVENT" API:

TRACEPOINT_EVENT
TRACEPOINT_CREATE_PROBES
TRACEPOINT_EVENT_LIB

And move the current tracepoint declaration/definition to a more
standard name (these will become internal API when we switch to
TRACEPOINT_EVENT):

DEFINE_TRACEPOINT
DECLARE_TRACEPOINT

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
15 files changed:
include/ust/define_trace.h
include/ust/tracepoint.h
include/ust/ust_trace.h
libust-initializer.c
libust-initializer.h
tests/hello/tp.c
tests/hello/tp.h
tests/register_test/register_test.c
tests/register_test/tp.h
tests/trace_event/trace_event_test.c
tests/trace_event/trace_event_test.h
tests/tracepoint/benchmark/tracepoint_benchmark.c
tests/tracepoint/benchmark/tracepoint_benchmark.h
tests/tracepoint/tracepoint_test.c
tests/tracepoint/tracepoint_test.h

index b4a29fb249b504eb1e9181f568fca5694306a05e..3d2954167f10031963c2819c832af0f7dedc8e34 100644 (file)
  *     modules must be used.
  */
 
-#ifdef CREATE_TRACE_POINTS
+#ifdef TRACEPOINT_CREATE_PROBES
 
 /* Prevent recursion */
-#undef CREATE_TRACE_POINTS
+#undef TRACEPOINT_CREATE_PROBES
 
 #include <ust/kcompat/stringify.h>
 
-#undef TRACE_EVENT
-#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
-       DEFINE_TRACE(name)
+#undef TRACEPOINT_EVENT
+#define TRACEPOINT_EVENT(name, proto, args, tstruct, assign, print)    \
+       DEFINE_TRACEPOINT(name)
 
-#undef TRACE_EVENT_FN
-#define TRACE_EVENT_FN(name, proto, args, tstruct,             \
+#undef TRACEPOINT_EVENT_FN
+#define TRACEPOINT_EVENT_FN(name, proto, args, tstruct,                \
                assign, print, reg, unreg)                      \
-       DEFINE_TRACE_FN(name, reg, unreg)
+       DEFINE_TRACEPOINT_FN(name, reg, unreg)
 
-#undef DEFINE_TRACE_EVENT
-#define DEFINE_TRACE_EVENT(template, name, proto, args) \
-       DEFINE_TRACE(name)
+#undef DEFINE_TRACEPOINT_EVENT
+#define DEFINE_TRACEPOINT_EVENT(template, name, proto, args) \
+       DEFINE_TRACEPOINT(name)
 
-#undef DEFINE_TRACE_EVENT_PRINT
-#define DEFINE_TRACE_EVENT_PRINT(template, name, proto, args, print)   \
-       DEFINE_TRACE(name)
+#undef DEFINE_TRACEPOINT_EVENT_PRINT
+#define DEFINE_TRACEPOINT_EVENT_PRINT(template, name, proto, args, print)      \
+       DEFINE_TRACEPOINT(name)
 
-#undef DECLARE_TRACE
-#define DECLARE_TRACE(name, proto, args)       \
-       DEFINE_TRACE(name)
+#undef DECLARE_TRACEPOINT
+#define DECLARE_TRACEPOINT(name, proto, args)  \
+       DEFINE_TRACEPOINT(name)
 
 #undef TRACE_INCLUDE
 #undef __TRACE_INCLUDE
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
-/* Make all open coded DECLARE_TRACE nops */
-#undef DECLARE_TRACE
-#define DECLARE_TRACE(name, proto, args)
+/* Make all open coded DECLARE_TRACEPOINT nops */
+#undef DECLARE_TRACEPOINT
+#define DECLARE_TRACEPOINT(name, proto, args)
 
 #ifndef CONFIG_NO_EVENT_TRACING
 #include <ust/ust_trace.h>
 #endif
 
-#undef TRACE_EVENT
-#undef TRACE_EVENT_FN
-#undef DECLARE_TRACE_EVENT_CLASS
-#undef DEFINE_TRACE_EVENT
-#undef DEFINE_TRACE_EVENT_PRINT
+#undef TRACEPOINT_EVENT
+#undef TRACEPOINT_EVENT_FN
+#undef DECLARE_TRACEPOINT_EVENT_CLASS
+#undef DEFINE_TRACEPOINT_EVENT
+#undef DEFINE_TRACEPOINT_EVENT_PRINT
 #undef TRACE_HEADER_MULTI_READ
-#undef DECLARE_TRACE
+#undef DECLARE_TRACEPOINT
 
 /* Only undef what we defined in this file */
 #ifdef UNDEF_TRACE_INCLUDE_FILE
 #endif
 
 /* We may be processing more files */
-#define CREATE_TRACE_POINTS
+#define TRACEPOINT_CREATE_PROBES
 
-#endif /* CREATE_TRACE_POINTS */
+#endif /* TRACEPOINT_CREATE_PROBES */
index 278a9c19fd577db7c634e0c1ce76269c8c07203b..b9557d5703e91ff4082e241e567edc0d8e521d05 100644 (file)
@@ -95,7 +95,7 @@ struct tracepoint {
  * not add unwanted padding between the beginning of the section and the
  * structure. Force alignment to the same alignment as the section start.
  */
-#define __DECLARE_TRACE(name, proto, args, data_proto, data_args)      \
+#define __DECLARE_TRACEPOINT(name, proto, args, data_proto, data_args) \
        extern struct tracepoint __tracepoint_##name;                   \
        static inline void __trace_##name(proto)                        \
        {                                                               \
@@ -116,7 +116,7 @@ struct tracepoint {
                                                   data);               \
        }
 
-#define DEFINE_TRACE_FN(name, reg, unreg)                              \
+#define DEFINE_TRACEPOINT_FN(name, reg, unreg)                         \
        static const char __tpstrtab_##name[]                           \
        __attribute__((section("__tracepoints_strings"))) = #name;      \
        struct tracepoint __tracepoint_##name                           \
@@ -126,14 +126,14 @@ struct tracepoint {
        __attribute__((used, section("__tracepoints_ptrs"))) =          \
                &__tracepoint_##name;
 
-#define DEFINE_TRACE(name)                                             \
-       DEFINE_TRACE_FN(name, NULL, NULL)
+#define DEFINE_TRACEPOINT(name)                                                \
+       DEFINE_TRACEPOINT_FN(name, NULL, NULL)
 
 extern void tracepoint_update_probe_range(struct tracepoint * const *begin,
        struct tracepoint * const *end);
 
 #else /* !CONFIG_TRACEPOINTS */
-#define __DECLARE_TRACE(name, proto, args)                             \
+#define __DECLARE_TRACEPOINT(name, proto, args)                                \
        static inline void trace_##name(proto)                          \
        { }                                                             \
        static inline void _trace_##name(proto)                         \
@@ -147,7 +147,7 @@ extern void tracepoint_update_probe_range(struct tracepoint * const *begin,
                return -ENOSYS;                                         \
        }
 
-#define DEFINE_TRACE(name)
+#define DEFINE_TRACEPOINT(name)
 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
 #define EXPORT_TRACEPOINT_SYMBOL(name)
 
@@ -157,24 +157,24 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
 #endif /* CONFIG_TRACEPOINTS */
 
 /*
- * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype
+ * The need for the DECLARE_TRACEPOINT_NOARGS() is to handle the prototype
  * (void). "void" is a special value in a function prototype and can
- * not be combined with other arguments. Since the DECLARE_TRACE()
+ * not be combined with other arguments. Since the DECLARE_TRACEPOINT()
  * macro adds a data element at the beginning of the prototype,
  * we need a way to differentiate "(void *data, proto)" from
  * "(void *data, void)". The second prototype is invalid.
  *
- * DECLARE_TRACE_NOARGS() passes "void" as the tracepoint prototype
+ * DECLARE_TRACEPOINT_NOARGS() passes "void" as the tracepoint prototype
  * and "void *__tp_cb_data" as the callback prototype.
  *
- * DECLARE_TRACE() passes "proto" as the tracepoint protoype and
+ * DECLARE_TRACEPOINT() passes "proto" as the tracepoint protoype and
  * "void *__tp_cb_data, proto" as the callback prototype.
  */
-#define DECLARE_TRACE_NOARGS(name)                                     \
-               __DECLARE_TRACE(name, void, , void *__tp_cb_data, __tp_cb_data)
+#define DECLARE_TRACEPOINT_NOARGS(name)                                        \
+               __DECLARE_TRACEPOINT(name, void, , void *__tp_cb_data, __tp_cb_data)
 
-#define DECLARE_TRACE(name, proto, args)                               \
-               __DECLARE_TRACE(name, TP_PARAMS(proto), TP_PARAMS(args),\
+#define DECLARE_TRACEPOINT(name, proto, args)                          \
+               __DECLARE_TRACEPOINT(name, TP_PARAMS(proto), TP_PARAMS(args),\
                                TP_PARAMS(void *__tp_cb_data, proto),   \
                                TP_PARAMS(__tp_cb_data, args))
 
@@ -246,21 +246,21 @@ extern int tracepoint_unregister_lib(struct tracepoint * const *tracepoints_star
        }
 
 
-#ifndef TRACE_EVENT
+#ifndef TRACEPOINT_EVENT
 /*
- * For use with the TRACE_EVENT macro:
+ * For use with the TRACEPOINT_EVENT macro:
  *
  * We define a tracepoint, its arguments, its printf format
  * and its 'fast binary record' layout.
  *
- * Firstly, name your tracepoint via TRACE_EVENT(name : the
+ * Firstly, name your tracepoint via TRACEPOINT_EVENT(name : the
  * 'subsystem_event' notation is fine.
  *
  * Think about this whole construct as the
  * 'trace_sched_switch() function' from now on.
  *
  *
- *  TRACE_EVENT(sched_switch,
+ *  TRACEPOINT_EVENT(sched_switch,
  *
  *     *
  *     * A function has a regular function arguments
@@ -344,7 +344,7 @@ extern int tracepoint_unregister_lib(struct tracepoint * const *tracepoints_star
  * tracing setup.
  *
  * A set of (un)registration functions can be passed to the variant
- * TRACE_EVENT_FN to perform any (un)registration work.
+ * TRACEPOINT_EVENT_FN to perform any (un)registration work.
  */
 
 struct trace_event {
@@ -383,7 +383,7 @@ extern int trace_event_register_lib(struct trace_event * const *start_trace_even
 
 extern int trace_event_unregister_lib(struct trace_event * const *start_trace_events);
 
-#define TRACE_EVENT_LIB                                                        \
+#define TRACEPOINT_EVENT_LIB                                           \
        extern struct trace_event * const __start___trace_events_ptrs[] \
        __attribute__((weak, visibility("hidden")));                    \
        extern struct trace_event * const __stop___trace_events_ptrs[]  \
@@ -404,19 +404,19 @@ extern int trace_event_unregister_lib(struct trace_event * const *start_trace_ev
                trace_event_unregister_lib(__start___trace_events_ptrs);\
        }
 
-#define DECLARE_TRACE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
-#define DEFINE_TRACE_EVENT(template, name, proto, args)                \
-       DECLARE_TRACE(name, TP_PARAMS(proto), TP_PARAMS(args))
-#define DEFINE_TRACE_EVENT_PRINT(template, name, proto, args, print)   \
-       DECLARE_TRACE(name, TP_PARAMS(proto), TP_PARAMS(args))
+#define DECLARE_TRACEPOINT_EVENT_CLASS(name, proto, args, tstruct, assign, print)
+#define DEFINE_TRACEPOINT_EVENT(template, name, proto, args)           \
+       DECLARE_TRACEPOINT(name, TP_PARAMS(proto), TP_PARAMS(args))
+#define DEFINE_TRACEPOINT_EVENT_PRINT(template, name, proto, args, print)\
+       DECLARE_TRACEPOINT(name, TP_PARAMS(proto), TP_PARAMS(args))
 
-#define TRACE_EVENT(name, proto, args, struct, assign, print)  \
-       DECLARE_TRACE(name, TP_PARAMS(proto), TP_PARAMS(args))
-#define TRACE_EVENT_FN(name, proto, args, struct,              \
+#define TRACEPOINT_EVENT(name, proto, args, struct, assign, print)     \
+       DECLARE_TRACEPOINT(name, TP_PARAMS(proto), TP_PARAMS(args))
+#define TRACEPOINT_EVENT_FN(name, proto, args, struct,         \
                assign, print, reg, unreg)                      \
-       DECLARE_TRACE(name, TP_PARAMS(proto), TP_PARAMS(args))
+       DECLARE_TRACEPOINT(name, TP_PARAMS(proto), TP_PARAMS(args))
 
-#endif /* ifdef TRACE_EVENT (see note above) */
+#endif /* ifdef TRACEPOINT_EVENT (see note above) */
 
 
 #endif /* _UST_TRACEPOINT_H */
index f2ccbe21e868fbbc579b871f3026f1a6a9283ff9..dfbe16648e31985159798446bd82a5c88e1fbf3d 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2009     Steven Rostedt <srostedt@redhat.com>
  * Copyright (C) 2010     Nils Carlson <nils.carlson@ericsson.com>
+ * Copyright (C) 2011     Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
- *
  */
 
 /*
- * This whole file is currently a dummy, mapping a TRACE_EVENT
+ * This whole file is currently a dummy, mapping a TRACEPOINT_EVENT
  * to a printf
  */
 
  * Stage 1. Create a struct and a printf calling function
  * that is connected to the tracepoint at load time.
  */
-#undef TRACE_EVENT
-#define TRACE_EVENT(name, proto, args, tstruct, assign, print)         \
-       DECLARE_TRACE_EVENT_CLASS(name,                                 \
+#undef TRACEPOINT_EVENT
+#define TRACEPOINT_EVENT(name, proto, args, tstruct, assign, print)    \
+       DECLARE_TRACEPOINT_EVENT_CLASS(name,                            \
                                  TP_PARAMS(proto),                     \
                                  TP_PARAMS(args),                      \
                                  TP_PARAMS(tstruct),                   \
                                  TP_PARAMS(assign),                    \
                                  TP_PARAMS(print));                    \
-       DEFINE_TRACE_EVENT(name, name, TP_PARAMS(proto), TP_PARAMS(args));
+       DEFINE_TRACEPOINT_EVENT(name, name, TP_PARAMS(proto), TP_PARAMS(args));
 
 #undef __field
 #define __field(type, item)            type    item;
 #undef TP_fast_assign
 #define TP_fast_assign(args...) args
 
-#undef DEFINE_TRACE_EVENT
-#define DEFINE_TRACE_EVENT(template, name, proto, args)
+#undef DEFINE_TRACEPOINT_EVENT
+#define DEFINE_TRACEPOINT_EVENT(template, name, proto, args)
 
 
-#undef DECLARE_TRACE_EVENT_CLASS
-#define DECLARE_TRACE_EVENT_CLASS(name, proto, args, tstruct, assign, print)   \
+#undef DECLARE_TRACEPOINT_EVENT_CLASS
+#define DECLARE_TRACEPOINT_EVENT_CLASS(name, proto, args, tstruct, assign, print)      \
        struct trace_raw_##name {                                       \
                tstruct                                                 \
        };                                                              \
index 83635d64b318a3497615eacd4bbe8ac313f3286d..efe707e5672c752ef54bb57bcaf46e03c86c1e6e 100644 (file)
@@ -13,4 +13,4 @@
 
 UST_MARKER_LIB;
 TRACEPOINT_LIB;
-TRACE_EVENT_LIB;
+TRACEPOINT_EVENT_LIB;
index b5d88acb21f8e7c7534cd8aa6865bd5fd313af1f..3c4e95bba915b8d720f7ea68db755c6381be9f5c 100644 (file)
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM ust_dummy
 
-#if !defined(_TRACE_EVENT_TEST_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_EVENT_TEST_H
+#if !defined(_TRACEPOINT_EVENT_TEST_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACEPOINT_EVENT_TEST_H
 
 #include <ust/tracepoint.h>
 
-TRACE_EVENT(ust_dummy_event,
+TRACEPOINT_EVENT(ust_dummy_event,
 
        TP_PROTO(int dummy_int),
 
@@ -39,7 +39,7 @@ TRACE_EVENT(ust_dummy_event,
        TP_printf("dummy=%d", __entry->dummy)
 );
 
-#endif /* _TRACE_EVENT_TEST_H */
+#endif /* _TRACEPOINT_EVENT_TEST_H */
 
 /* This part must be outside protection */
 #undef TRACE_INCLUDE_PATH
index 4eb7a27463e36b89e63a1ba1a9eea71ff8b25087..05cd7a2d703997a9ea65260527d73e806ed7ed8b 100644 (file)
@@ -27,7 +27,7 @@ struct hello_trace_struct hello_struct = {
        .message = "ehlo\n",
 };
 
-DEFINE_TRACE(hello_tptest);
+DEFINE_TRACEPOINT(hello_tptest);
 
 void tptest_probe(void *data, int anint)
 {
index 73819514d3e266512177bc09aa531228a074ff36..833cb40c85fe9a98d3b0341e15627f0e30c25027 100644 (file)
@@ -17,8 +17,8 @@
 
 #include <ust/tracepoint.h>
 
-DECLARE_TRACE(hello_tptest,
-             TP_PROTO(int anint),
-             TP_ARGS(anint));
+DECLARE_TRACEPOINT(hello_tptest,
+                  TP_PROTO(int anint),
+                  TP_ARGS(anint));
 
-DECLARE_TRACE_NOARGS(hello_tptest2);
+DECLARE_TRACEPOINT_NOARGS(hello_tptest2);
index 02225deb56fa32fc9fe780c0137d82006fce4463..8198a2c451ace4cc7b4ff5c3244823e1046e1054 100644 (file)
@@ -29,7 +29,7 @@
 #include "usterr.h"
 #include "tp.h"
 
-DEFINE_TRACE(hello_tptest);
+DEFINE_TRACEPOINT(hello_tptest);
 
 
 struct hello_trace_struct {
index f34f305410e082668a2fc42981c2509e90469f21..ee5fd0221c3ab78e1b8ef450561f94aeac834c68 100644 (file)
@@ -17,6 +17,6 @@
 
 #include <ust/tracepoint.h>
 
-DECLARE_TRACE(hello_tptest,
-             TP_PROTO(int anint),
-             TP_ARGS(anint));
+DECLARE_TRACEPOINT(hello_tptest,
+                  TP_PROTO(int anint),
+                  TP_ARGS(anint));
index b38e7ad20a30f99f14e8fbdd380ffd61fefbecd1..8e87846e1b3696b1c4c03312525213e79997f3a5 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdio.h>
 #include <ust/clock.h>
 
-#define CREATE_TRACE_POINTS
+#define TRACEPOINT_CREATE_PROBES
 #include "trace_event_test.h"
 
 int main(int argc, char * argv[])
index b9843bfe19f77e78883c00a00632f8e7ffd2ea2b..38f0b466a369c034d499acdc2a09267590b2357f 100644 (file)
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM trace_event_test
 
-#if !defined(_TRACE_EVENT_TEST_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_EVENT_TEST_H
+#if !defined(_TRACEPOINT_EVENT_TEST_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACEPOINT_EVENT_TEST_H
 
 #include <ust/tracepoint.h>
 
-TRACE_EVENT(test,
+TRACEPOINT_EVENT(test,
 
        TP_PROTO(unsigned long time, unsigned long count),
 
@@ -41,7 +41,7 @@ TRACE_EVENT(test,
        TP_printf("time=%lu count=%lu", __entry->time, __entry->count)
 );
 
-#endif /* _TRACE_EVENT_TEST_H */
+#endif /* _TRACEPOINT_EVENT_TEST_H */
 
 /* This part must be outside protection */
 #undef TRACE_INCLUDE_PATH
index 5d2397575ca3e1b2be4edf12d2913b4521cb8d38..50a184707a7a36510dbdc38df92bb2e7edb64957 100644 (file)
@@ -30,7 +30,7 @@
 
 #define NR_EVENTS      10000000
 
-DEFINE_TRACE(ust_event);
+DEFINE_TRACEPOINT(ust_event);
 
 void tp_probe(void *data, unsigned int p1);
 
index a9fcb1924311644b94aab6a1b0ce9a7a361eee81..f96f4622595c5b67482fc8a0834ce374dca75302 100644 (file)
@@ -1,3 +1,3 @@
 #include <ust/tracepoint.h>
 
-DECLARE_TRACE(ust_event, TP_PROTO(unsigned int v), TP_ARGS(v));
+DECLARE_TRACEPOINT(ust_event, TP_PROTO(unsigned int v), TP_ARGS(v));
index 78171b8f437d4754a0cb312add80263418dbd696..34cdb115dd32e8bfbe88927eab7263294d5fbe8c 100644 (file)
@@ -32,8 +32,8 @@
 #include <ust/marker.h>
 #include "tracepoint_test.h"
 
-DEFINE_TRACE(ust_event);
-DEFINE_TRACE(ust_event2);
+DEFINE_TRACEPOINT(ust_event);
+DEFINE_TRACEPOINT(ust_event2);
 
 static struct message msg_probe3 = {
        .payload = "probe3",
index 6b4dcdbce6850f9d05d633c5c047506312cfaec4..1899fe4e8c16bb2ed965c80281a531845f56790c 100644 (file)
@@ -1,7 +1,7 @@
 #include <ust/tracepoint.h>
 
-DECLARE_TRACE(ust_event, TP_PROTO(unsigned int v), TP_ARGS(v));
-DECLARE_TRACE(ust_event2, TP_PROTO(unsigned int v), TP_ARGS(v));
+DECLARE_TRACEPOINT(ust_event, TP_PROTO(unsigned int v), TP_ARGS(v));
+DECLARE_TRACEPOINT(ust_event2, TP_PROTO(unsigned int v), TP_ARGS(v));
 
 struct message {
        char *payload;
This page took 0.036752 seconds and 4 git commands to generate.