1 #ifndef _UST_MARKER_INTERNAL_H
2 #define _UST_MARKER_INTERNAL_H
5 * Code markup for dynamic and static tracing. (internal header)
7 * See Documentation/marker.txt.
9 * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 * (C) Copyright 2009 Pierre-Marc Fournier <pierre-marc dot fournier at polymtl dot ca>
11 * (C) Copyright 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation;
16 * version 2.1 of the License.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 #include <bits/wordsize.h>
31 #include <urcu/list.h>
33 #include <ust/kcompat/kcompat.h>
34 #include <ust/marker.h>
36 #define GET_UST_MARKER(name) (__ust_marker_def_##name)
38 #define DEFINE_UST_MARKER(name, format) \
39 _DEFINE_UST_MARKER(ust, name, NULL, NULL, format)
41 #define DEFINE_UST_MARKER_TP(name, tp_name, tp_cb, format) \
42 _DEFINE_UST_MARKER(ust, name, #tp_name, tp_cb, format)
44 #define __ust_marker_tp(name, call_private, tp_name, tp_cb, \
47 void __check_tp_type(void) \
49 register_trace_##tp_name(tp_cb, call_private); \
51 DEFINE_UST_MARKER_TP(name, #tp_name, tp_cb, format); \
52 __ust_marker_check_format(format, ## args); \
53 (*__ust_marker_def_##name.call) \
54 (&__ust_marker_def_##name, call_private, ## args); \
58 * ust_marker_tp - Marker in a tracepoint callback
59 * @name: marker name, not quoted.
60 * @tp_name: tracepoint name, not quoted.
61 * @tp_cb: tracepoint callback. Should have an associated global symbol so it
62 * is not optimized away by the compiler (should not be static).
63 * @format: format string
64 * @args...: variable argument list
66 * Places a marker in a tracepoint callback.
68 #define ust_marker_tp(name, tp_name, tp_cb, format, args...) \
69 __ust_marker_tp(ust, name, NULL, tp_name, tp_cb, format, ## args)
71 extern void ust_marker_compact_event_ids(void);
74 * Connect a probe to a marker.
75 * private data pointer must be a valid allocated memory address, or NULL.
77 extern int ust_marker_probe_register(const char *channel
, const char *name
,
78 const char *format
, ust_marker_probe_func
*probe
, void *probe_private
);
81 * Returns the private data given to ust_marker_probe_register.
83 extern int ust_marker_probe_unregister(const char *channel
, const char *name
,
84 ust_marker_probe_func
*probe
, void *probe_private
);
86 * Unregister a marker by providing the registered private data.
88 extern int ust_marker_probe_unregister_private_data(ust_marker_probe_func
*probe
,
91 extern void *ust_marker_get_private_data(const char *channel
, const char *name
,
92 ust_marker_probe_func
*probe
, int num
);
95 * ust_marker_synchronize_unregister must be called between the last
96 * marker probe unregistration and the first one of
97 * - the end of library exit function
98 * - the free of any resource used by the probes
99 * to ensure the code and data are valid for any possibly running probes.
101 #define ust_marker_synchronize_unregister() synchronize_rcu()
103 struct ust_marker_iter
{
104 struct ust_marker_lib
*lib
;
105 struct ust_marker
* const *ust_marker
;
108 extern void ust_marker_iter_start(struct ust_marker_iter
*iter
);
109 extern void ust_marker_iter_next(struct ust_marker_iter
*iter
);
110 extern void ust_marker_iter_stop(struct ust_marker_iter
*iter
);
111 extern void ust_marker_iter_reset(struct ust_marker_iter
*iter
);
113 extern int is_ust_marker_enabled(const char *channel
, const char *name
);
115 extern void ust_marker_set_new_ust_marker_cb(void (*cb
)(struct ust_marker
*));
116 extern void init_ust_marker(void);
118 void lock_ust_marker(void);
119 void unlock_ust_marker(void);
121 #endif /* _UST_MARKER_INTERNAL_H */
This page took 0.033515 seconds and 5 git commands to generate.