event-rule: introduce event rule tracepoint
[lttng-tools.git] / include / lttng / event-rule / tracepoint.h
1 /*
2 * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #ifndef LTTNG_EVENT_RULE_TRACEPOINT_H
9 #define LTTNG_EVENT_RULE_TRACEPOINT_H
10
11 #include <lttng/domain.h>
12 #include <lttng/event-rule/event-rule.h>
13 #include <lttng/event.h>
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 /*
20 * Create a newly allocated tracepoint event rule.
21 *
22 * Returns a new event rule on success, NULL on failure. This event rule must be
23 * destroyed using lttng_event_rule_destroy().
24 */
25 extern struct lttng_event_rule *lttng_event_rule_tracepoint_create(
26 enum lttng_domain_type domain);
27
28 /*
29 * Set the pattern of a tracepoint event rule.
30 *
31 * Pattern can contain wildcard '*'. See man lttng-enable-event.
32 *
33 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
34 * if invalid parameters are passed.
35 */
36 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_pattern(
37 struct lttng_event_rule *rule, const char *pattern);
38
39 /*
40 * Get the pattern of a tracepoint event rule.
41 *
42 * The caller does not assume the ownership of the returned pattern. The
43 * pattern shall only only be used for the duration of the event rule's
44 * lifetime, or before a different pattern is set.
45 *
46 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's pattern
47 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
48 * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
49 * was not set prior to this call.
50 */
51 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_pattern(
52 const struct lttng_event_rule *rule, const char **pattern);
53
54 /*
55 * Get the domain type of a tracepoint event rule.
56 *
57 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the domain type output parameter
58 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
59 * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern was not set prior to
60 * this call.
61 */
62 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_domain_type(
63 const struct lttng_event_rule *rule,
64 enum lttng_domain_type *type);
65
66 /*
67 * Set the filter expression of a tracepoint event rule.
68 *
69 * The expression is copied internally.
70 *
71 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
72 * if invalid parameters are passed.
73 */
74 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_filter(
75 struct lttng_event_rule *rule, const char *expression);
76
77 /*
78 * Get the filter expression of a tracepoint event rule.
79 *
80 * The caller does not assume the ownership of the returned filter expression.
81 * The filter expression shall only only be used for the duration of the event
82 * rule's lifetime, or before a different filter expression is set.
83 *
84 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's filter
85 * expression on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
86 * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
87 * was not set prior to this call.
88 */
89 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_filter(
90 const struct lttng_event_rule *rule, const char **expression);
91
92 /*
93 * Set the single log level of a tracepoint event rule.
94 *
95 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
96 * if invalid parameters are passed.
97 */
98 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_log_level(
99 struct lttng_event_rule *rule, int level);
100
101 /*
102 * Set the log level range lower bound of a tracepoint event rule.
103 *
104 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
105 * if invalid parameters are passed.
106 */
107 extern enum lttng_event_rule_status
108 lttng_event_rule_tracepoint_set_log_level_range_lower_bound(
109 struct lttng_event_rule *rule, int level);
110
111 /*
112 * Set the log level to all of a tracepoint event rule.
113 *
114 * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
115 * if invalid parameters are passed.
116 */
117 extern enum lttng_event_rule_status
118 lttng_event_rule_tracepoint_set_log_level_all(struct lttng_event_rule *rule);
119
120 /*
121 * Get the log level type of a tracepoint event rule.
122 *
123 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the log level type output
124 * parameter on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter
125 * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level was not set prior
126 * to this call.
127 */
128 extern enum lttng_event_rule_status
129 lttng_event_rule_tracepoint_get_log_level_type(
130 const struct lttng_event_rule *rule,
131 enum lttng_loglevel_type *type);
132
133 /*
134 * Get the log level of a tracepoint event rule.
135 *
136 * For range log level , the lower bound log level is returned.
137 *
138 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the log level output parameter
139 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
140 * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level was not set prior to
141 * this call.
142 */
143 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_log_level(
144 const struct lttng_event_rule *rule, int *level);
145
146 /*
147 * Add an exclusion to the set of exclusion of an event rule.
148 *
149 * The passed exclusion will be copied to the event_rule.
150 *
151 * Returns LTTNG_EVENT_RULE_STATUS_OK on success,
152 * LTTNG_EVENT_RULE_STATUS_INVALID if invalid parameters are passed, or
153 * LTTNG_EVENT_RULE_STATUS_UNSUPPORTED if this property is not supported by the
154 * domain.
155 */
156 extern enum lttng_event_rule_status lttng_event_rule_tracepoint_add_exclusion(
157 struct lttng_event_rule *rule,
158 const char *exclusion);
159
160 /*
161 * Get the exclusions property count of an event rule.
162 *
163 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the count output parameter
164 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
165 * passed.
166 */
167 extern enum lttng_event_rule_status
168 lttng_event_rule_tracepoint_get_exclusions_count(
169 const struct lttng_event_rule *rule, unsigned int *count);
170
171 /*
172 * Get the event rule exclusion at the given index.
173 *
174 * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the exclusion output parameter
175 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
176 * passed.
177 */
178 extern enum lttng_event_rule_status
179 lttng_event_rule_tracepoint_get_exclusion_at_index(
180 const struct lttng_event_rule *rule,
181 unsigned int index,
182 const char **exclusion);
183
184 #ifdef __cplusplus
185 }
186 #endif
187
188 #endif /* LTTNG_EVENT_RULE_TRACEPOINT_H */
This page took 0.061573 seconds and 5 git commands to generate.