Privatize part of marker.h, and type-serializer.h
[ust.git] / include / ust / marker-internal.h
1 #ifndef _UST_MARKER_INTERNAL_H
2 #define _UST_MARKER_INTERNAL_H
3
4 /*
5 * Code markup for dynamic and static tracing. (internal header)
6 *
7 * See Documentation/marker.txt.
8 *
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>
12 *
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.
17 *
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.
22 *
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
26 */
27
28 #include <stdarg.h>
29 #include <bits/wordsize.h>
30 #include <urcu-bp.h>
31 #include <urcu/list.h>
32 #include <ust/core.h>
33 #include <ust/kcompat/kcompat.h>
34 #include <ust/marker.h>
35
36 #define GET_UST_MARKER(name) (__ust_marker_def_##name)
37
38 #define DEFINE_UST_MARKER(name, format) \
39 _DEFINE_UST_MARKER(ust, name, NULL, NULL, format)
40
41 #define DEFINE_UST_MARKER_TP(name, tp_name, tp_cb, format) \
42 _DEFINE_UST_MARKER(ust, name, #tp_name, tp_cb, format)
43
44 #define __ust_marker_tp(name, call_private, tp_name, tp_cb, \
45 format, args...) \
46 do { \
47 void __check_tp_type(void) \
48 { \
49 register_trace_##tp_name(tp_cb, call_private); \
50 } \
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); \
55 } while (0)
56
57 /**
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
65 *
66 * Places a marker in a tracepoint callback.
67 */
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)
70
71 extern void ust_marker_update_probe_range(struct ust_marker * const *begin,
72 struct ust_marker * const *end);
73
74 extern void lock_ust_marker(void);
75 extern void unlock_ust_marker(void);
76
77 extern void ust_marker_compact_event_ids(void);
78
79 /*
80 * Connect a probe to a marker.
81 * private data pointer must be a valid allocated memory address, or NULL.
82 */
83 extern int ust_marker_probe_register(const char *channel, const char *name,
84 const char *format, ust_marker_probe_func *probe, void *probe_private);
85
86 /*
87 * Returns the private data given to ust_marker_probe_register.
88 */
89 extern int ust_marker_probe_unregister(const char *channel, const char *name,
90 ust_marker_probe_func *probe, void *probe_private);
91 /*
92 * Unregister a marker by providing the registered private data.
93 */
94 extern int ust_marker_probe_unregister_private_data(ust_marker_probe_func *probe,
95 void *probe_private);
96
97 extern void *ust_marker_get_private_data(const char *channel, const char *name,
98 ust_marker_probe_func *probe, int num);
99
100 /*
101 * ust_marker_synchronize_unregister must be called between the last
102 * marker probe unregistration and the first one of
103 * - the end of library exit function
104 * - the free of any resource used by the probes
105 * to ensure the code and data are valid for any possibly running probes.
106 */
107 #define ust_marker_synchronize_unregister() synchronize_rcu()
108
109 struct ust_marker_iter {
110 struct ust_marker_lib *lib;
111 struct ust_marker * const *ust_marker;
112 };
113
114 extern void ust_marker_iter_start(struct ust_marker_iter *iter);
115 extern void ust_marker_iter_next(struct ust_marker_iter *iter);
116 extern void ust_marker_iter_stop(struct ust_marker_iter *iter);
117 extern void ust_marker_iter_reset(struct ust_marker_iter *iter);
118 extern int ust_marker_get_iter_range(struct ust_marker * const **marker, struct ust_marker * const *begin,
119 struct ust_marker * const *end);
120
121 extern void ust_marker_update_process(void);
122 extern int is_ust_marker_enabled(const char *channel, const char *name);
123
124 extern void ust_marker_set_new_ust_marker_cb(void (*cb)(struct ust_marker *));
125 extern void init_ust_marker(void);
126
127 #endif /* _UST_MARKER_INTERNAL_H */
This page took 0.031742 seconds and 4 git commands to generate.