Add lttng_ust_ prefix before objd_unref
[lttng-ust.git] / include / ust / tracepoint.h
index 11de23dcffde26dea9b05c9e14d8184a8019603d..e39a3849bc8b928bc7aaff2e5d4f5192eb300a5b 100644 (file)
 #include <urcu-bp.h>
 #include <urcu/list.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct tracepoint_probe {
        void *func;
        void *data;
@@ -61,7 +65,7 @@ struct tracepoint {
                        do {                                            \
                                __tp_it_func = __tp_it_probe_ptr->func; \
                                __tp_cb_data = __tp_it_probe_ptr->data; \
-                               ((void(*)(proto))__tp_it_func)(args);   \
+                               URCU_FORCE_CAST(void(*)(proto), __tp_it_func)(args); \
                        } while ((++__tp_it_probe_ptr)->func);          \
                }                                                       \
                rcu_read_unlock();                                      \
@@ -73,7 +77,7 @@ struct tracepoint {
 
 #define __CHECK_TRACE(name, proto, args)                               \
        do {                                                            \
-               if (unlikely(__tracepoint_##name.state))                \
+               if (caa_unlikely(__tracepoint_##name.state))            \
                        __DO_TRACE(&__tracepoint_##name,                \
                                TP_PROTO(proto), TP_ARGS(args));        \
        } while (0)
@@ -95,7 +99,6 @@ struct tracepoint {
        {                                                               \
                return __tracepoint_probe_register(#name, (void *)probe,\
                                                 data);                 \
-                                                                       \
        }                                                               \
        static inline int                                               \
        __unregister_trace_##name(void (*probe)(data_proto), void *data)\
@@ -232,6 +235,7 @@ static void __attribute__((destructor)) __tracepoints__destroy(void)
  *
  * Firstly, name your tracepoint via TRACEPOINT_EVENT(name,
  *
+ * The name should be a proper C99 identifier.
  * The "name" MUST follow these rules to ensure no namespace clash
  * occurs:
  *
@@ -327,6 +331,13 @@ static void __attribute__((destructor)) __tracepoints__destroy(void)
  *             ctf_integer(int, next_prio, next->prio)
  *     )
  * )
+ *
+ * Do _NOT_ add comma (,) nor semicolon (;) after the TRACEPOINT_EVENT
+ * declaration.
+ *
+ * The TRACEPOINT_SYSTEM must be defined when declaring a
+ * TRACEPOINT_EVENT. See ust/tracepoint-event.h for information about
+ * usage of other macros controlling TRACEPOINT_EVENT.
  */
 
 #define TRACEPOINT_EVENT(name, proto, args, fields)                    \
@@ -348,4 +359,65 @@ static void __attribute__((destructor)) __tracepoints__destroy(void)
 
 #endif /* #ifndef TRACEPOINT_EVENT */
 
+#ifndef TRACEPOINT_LOGLEVEL
+
+/*
+ * Tracepoint Loglevel Declaration Facility
+ *
+ * This is a place-holder the tracepoint loglevel declaration,
+ * overridden by the tracer implementation.
+ *
+ * Typical use of these loglevels:
+ *
+ * 1) Declare the mapping between loglevel names and an integer values
+ *    within TRACEPOINT_LOGLEVEL_ENUM, using TP_LOGLEVEL for each tuple.
+ *    Do _NOT_ add comma (,) nor semicolon (;) between the
+ *    TRACEPOINT_LOGLEVEL_ENUM entries. Do _NOT_ add comma (,) nor
+ *    semicolon (;) after the TRACEPOINT_LOGLEVEL_ENUM declaration.  The
+ *    name should be a proper C99 identifier.
+ *
+ *      TRACEPOINT_LOGLEVEL_ENUM(
+ *              TP_LOGLEVEL( < loglevel_name >, < value > )
+ *              TP_LOGLEVEL( < loglevel_name >, < value > )
+ *              ...
+ *      )
+ *
+ *    e.g.:
+ *
+ *      TRACEPOINT_LOGLEVEL_ENUM(
+ *              TP_LOGLEVEL(LOG_EMERG,   0)
+ *              TP_LOGLEVEL(LOG_ALERT,   1)
+ *              TP_LOGLEVEL(LOG_CRIT,    2)
+ *              TP_LOGLEVEL(LOG_ERR,     3)
+ *              TP_LOGLEVEL(LOG_WARNING, 4)
+ *              TP_LOGLEVEL(LOG_NOTICE,  5)
+ *              TP_LOGLEVEL(LOG_INFO,    6)
+ *              TP_LOGLEVEL(LOG_DEBUG,   7)
+ *      )
+ *
+ * 2) Then, declare tracepoint loglevels for tracepoints. A
+ *    TRACEPOINT_EVENT should be declared prior to the the
+ *    TRACEPOINT_LOGLEVEL for a given tracepoint name. The first field
+ *    is the name of the tracepoint, the second field is the loglevel
+ *    name.
+ *
+ *      TRACEPOINT_LOGLEVEL(< [com_company_]project_[component_]event >,
+ *              < loglevel_name >)
+ *
+ * The TRACEPOINT_SYSTEM must be defined when declaring a
+ * TRACEPOINT_LOGLEVEL_ENUM and TRACEPOINT_LOGLEVEL. The tracepoint
+ * loglevel enumeration apply to the entire TRACEPOINT_SYSTEM. Only one
+ * tracepoint loglevel enumeration should be declared per tracepoint
+ * system.
+ */
+
+#define TRACEPOINT_LOGLEVEL_ENUM()
+#define TRACEPOINT_LOGLEVEL(name, loglevel)
+
+#endif /* #ifndef TRACEPOINT_LOGLEVEL */
+
+#ifdef __cplusplus 
+}
+#endif
+
 #endif /* _UST_TRACEPOINT_H */
This page took 0.030767 seconds and 4 git commands to generate.