SoW-2019-0002: Dynamic Snapshot
[lttng-tools.git] / include / lttng / event-rule / tracepoint.h
1 /*
2 * Copyright (C) 2019 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18 #ifndef LTTNG_EVENT_RULE_TRACEPOINT_H
19 #define LTTNG_EVENT_RULE_TRACEPOINT_H
20
21 #include <lttng/event-rule/event-rule.h>
22 #include <lttng/domain.h>
23 #include <lttng/event.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /*
30 * TODO:
31 */
32 extern struct lttng_event_rule *lttng_event_rule_tracepoint_create(
33 enum lttng_domain_type domain);
34
35 /*
36 * Set the pattern of a tracepoint event rule.
37 *
38 * Pattern can contains wildcard '*'. See man lttng-enable-event.
39 *
40 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
41 * if invalid parameters are passed.
42 */
43 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_pattern(
44 struct lttng_event_rule *rule, const char *pattern);
45
46 /*
47 * Get the pattern of a tracepoint event rule.
48 *
49 * The caller does not assume the ownership of the returned pattern. The
50 * pattern shall only only be used for the duration of the event rule's
51 * lifetime, or before a different pattern is set.
52 *
53 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's pattern
54 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
55 * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
56 * was not set prior to this call.
57 */
58 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_pattern(
59 const struct lttng_event_rule *rule, const char **pattern);
60
61 /*
62 * Set the domain type of a tracepoint event rule.
63 *
64 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
65 * if invalid parameters are passed.
66 */
67 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_filter(
68 struct lttng_event_rule *rule, const char *expression);
69
70 /*
71 * Get the domain type of a tracecpoint event rule.
72 *
73 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the domain type output parameter
74 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
75 * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern was not set prior to
76 * this call.
77 */
78 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_domain_type(
79 const struct lttng_event_rule *rule,
80 enum lttng_domain_type *type);
81
82 /*
83 * Set the filter expression of a tracepoint event rule.
84 *
85 * The expression is copied.
86 *
87 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
88 * if invalid parameters are passed.
89 */
90 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_filter(
91 struct lttng_event_rule *rule, const char *expression);
92
93 /*
94 * Get the filter expression of a tracepoint event rule.
95 *
96 * The caller does not assume the ownership of the returned filter expression.
97 * The filter expression shall only only be used for the duration of the event
98 * rule's lifetime, or before a different filter expression is set.
99 *
100 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's filter
101 * expression on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
102 * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
103 * was not set prior to this call.
104 */
105 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_filter(
106 const struct lttng_event_rule *rule, const char **expression);
107
108 /*
109 * Set the single loglevel of a tracepoint event rule.
110 *
111 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
112 * if invalid parameters are passed.
113 */
114 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_loglevel(
115 struct lttng_event_rule *rule, int level);
116
117 /*
118 * Set the loglevel range of a tracepoint event rule.
119 *
120 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
121 * if invalid parameters are passed.
122 */
123 extern enum lttng_event_rule_status
124 lttng_event_rule_tracepoint_set_loglevel_range(
125 struct lttng_event_rule *rule, int level);
126
127 /*
128 * Set the loglevel to all of a tracepoint event rule.
129 *
130 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
131 * if invalid parameters are passed.
132 */
133 extern enum lttng_event_rule_status
134 lttng_event_rule_tracepoint_set_loglevel_all(struct lttng_event_rule *rule);
135
136 /*
137 * Get the loglevel type of a tracepoint event rule.
138 *
139 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the loglevel type output
140 * parameter on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter
141 * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a loglevel was not set prior
142 * to this call.
143 */
144 extern enum lttng_event_rule_status
145 lttng_event_rule_tracepoint_get_loglevel_type(
146 const struct lttng_event_rule *rule, enum lttng_loglevel_type *type);
147
148 /*
149 * Get the loglevel of a tracepoint event rule.
150 *
151 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the loglevel output parameter
152 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
153 * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a loglevel was not set prior to
154 * this call.
155 */
156 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_loglevel(
157 const struct lttng_event_rule *rule, int *level);
158
159 /*
160 * Set the exclusions property of a event rule.
161 *
162 * The passed exclusions will be copied to the event_rule.
163 *
164 * Returns LTTNG_EVENT_RULE_STATUS_OK on success,
165 * LTTNG_EVENT_RULE_STATUS_INVALID if invalid parameters are passed, or
166 * LTTNG_EVENT_RULE_STATUS_UNSUPPORTED if this property is not supported by the
167 * domain.
168 */
169 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_exclusions(
170 struct lttng_event_rule *rule,
171 unsigned int count,
172 const char **exclusions);
173
174 /*
175 * Get the exclusions property count of a event rule.
176 *
177 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the count output parameter
178 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
179 * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a domain type was not set prior
180 * to this call.
181 */
182 extern enum lttng_event_rule_status
183 lttng_event_rule_tracepoint_get_exclusions_count(
184 const struct lttng_event_rule *rule, unsigned int *count);
185
186 /*
187 * TODO:
188 * */
189 extern enum lttng_event_rule_status
190 lttng_event_rule_tracepoint_get_exclusion_at_index(
191 const struct lttng_event_rule *rule,
192 unsigned int index,
193 const char **exclusion);
194
195 #ifdef __cplusplus
196 }
197 #endif
198
199 #endif /* LTTNG_EVENT_RULE_TRACEPOINT_H */
This page took 0.049507 seconds and 5 git commands to generate.