Implement filter bytecode support in lttng-session, and parse filter string
[lttng-tools.git] / src / bin / lttng-sessiond / lttng-ust-ctl.h
1 /*
2 * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2 only,
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef _LTTNG_UST_CTL_H
20 #define _LTTNG_UST_CTL_H
21
22 #include "lttng-ust-abi.h"
23
24 int ustctl_register_done(int sock);
25 int ustctl_create_session(int sock);
26 int ustctl_open_metadata(int sock, int session_handle,
27 struct lttng_ust_channel_attr *chops,
28 struct lttng_ust_object_data **metadata_data);
29 int ustctl_create_channel(int sock, int session_handle,
30 struct lttng_ust_channel_attr *chops,
31 struct lttng_ust_object_data **channel_data);
32 int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data,
33 struct lttng_ust_object_data **stream_data);
34 int ustctl_create_event(int sock, struct lttng_ust_event *ev,
35 struct lttng_ust_object_data *channel_data,
36 struct lttng_ust_object_data **event_data);
37 int ustctl_add_context(int sock, struct lttng_ust_context *ctx,
38 struct lttng_ust_object_data *obj_data,
39 struct lttng_ust_object_data **context_data);
40 int ustctl_set_filter(int sock, struct lttng_ust_filter_bytecode *bytecode,
41 struct lttng_ust_object_data *obj_data);
42
43 int ustctl_enable(int sock, struct lttng_ust_object_data *object);
44 int ustctl_disable(int sock, struct lttng_ust_object_data *object);
45 int ustctl_start_session(int sock, int handle);
46 int ustctl_stop_session(int sock, int handle);
47
48 /*
49 * ustctl_tracepoint_list returns a tracepoint list handle, or negative
50 * error value.
51 */
52 int ustctl_tracepoint_list(int sock);
53 /*
54 * ustctl_tracepoint_list_get is used to iterate on the tp list
55 * handle. End is iteration is reached when -ENOENT is returned.
56 */
57 int ustctl_tracepoint_list_get(int sock, int tp_list_handle,
58 struct lttng_ust_tracepoint_iter *iter);
59
60 /*
61 * ustctl_tracepoint_field_list returns a tracepoint field list handle,
62 * or negative error value.
63 */
64 int ustctl_tracepoint_field_list(int sock);
65
66 /*
67 * ustctl_tracepoint_field_list_get is used to iterate on the tp field
68 * list handle. End is iteration is reached when -ENOENT is returned.
69 */
70 int ustctl_tracepoint_field_list_get(int sock, int tp_field_list_handle,
71 struct lttng_ust_field_iter *iter);
72
73 int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v);
74 int ustctl_wait_quiescent(int sock);
75
76 int ustctl_sock_flush_buffer(int sock, struct lttng_ust_object_data *object);
77
78 /* not implemented yet */
79 int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate);
80
81 /*
82 * Map channel lttng_ust_shm_handle and add streams. Typically performed by the
83 * consumer to map the objects into its memory space.
84 */
85 struct lttng_ust_shm_handle *ustctl_map_channel(struct lttng_ust_object_data *chan_data);
86 int ustctl_add_stream(struct lttng_ust_shm_handle *lttng_ust_shm_handle,
87 struct lttng_ust_object_data *stream_data);
88 /*
89 * Note: the lttng_ust_object_data from which the lttng_ust_shm_handle is derived can only
90 * be released after unmapping the handle.
91 */
92 void ustctl_unmap_channel(struct lttng_ust_shm_handle *lttng_ust_shm_handle);
93
94 /* Buffer operations */
95
96 struct lttng_ust_shm_handle;
97 struct lttng_ust_lib_ring_buffer;
98
99 /* Open/close stream buffers for read */
100 struct lttng_ust_lib_ring_buffer *ustctl_open_stream_read(struct lttng_ust_shm_handle *handle,
101 int cpu);
102 void ustctl_close_stream_read(struct lttng_ust_shm_handle *handle,
103 struct lttng_ust_lib_ring_buffer *buf);
104
105 /* For mmap mode, readable without "get" operation */
106 int ustctl_get_mmap_len(struct lttng_ust_shm_handle *handle,
107 struct lttng_ust_lib_ring_buffer *buf,
108 unsigned long *len);
109 int ustctl_get_max_subbuf_size(struct lttng_ust_shm_handle *handle,
110 struct lttng_ust_lib_ring_buffer *buf,
111 unsigned long *len);
112
113 /*
114 * For mmap mode, operate on the current packet (between get/put or
115 * get_next/put_next).
116 */
117 void *ustctl_get_mmap_base(struct lttng_ust_shm_handle *handle,
118 struct lttng_ust_lib_ring_buffer *buf);
119 int ustctl_get_mmap_read_offset(struct lttng_ust_shm_handle *handle,
120 struct lttng_ust_lib_ring_buffer *buf, unsigned long *off);
121 int ustctl_get_subbuf_size(struct lttng_ust_shm_handle *handle,
122 struct lttng_ust_lib_ring_buffer *buf, unsigned long *len);
123 int ustctl_get_padded_subbuf_size(struct lttng_ust_shm_handle *handle,
124 struct lttng_ust_lib_ring_buffer *buf, unsigned long *len);
125 int ustctl_get_next_subbuf(struct lttng_ust_shm_handle *handle,
126 struct lttng_ust_lib_ring_buffer *buf);
127 int ustctl_put_next_subbuf(struct lttng_ust_shm_handle *handle,
128 struct lttng_ust_lib_ring_buffer *buf);
129
130 /* snapshot */
131
132 int ustctl_snapshot(struct lttng_ust_shm_handle *handle,
133 struct lttng_ust_lib_ring_buffer *buf);
134 int ustctl_snapshot_get_consumed(struct lttng_ust_shm_handle *handle,
135 struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos);
136 int ustctl_snapshot_get_produced(struct lttng_ust_shm_handle *handle,
137 struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos);
138 int ustctl_get_subbuf(struct lttng_ust_shm_handle *handle,
139 struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos);
140 int ustctl_put_subbuf(struct lttng_ust_shm_handle *handle,
141 struct lttng_ust_lib_ring_buffer *buf);
142
143 void ustctl_flush_buffer(struct lttng_ust_shm_handle *handle,
144 struct lttng_ust_lib_ring_buffer *buf,
145 int producer_active);
146
147 /* Release object created by members of this API */
148 int ustctl_release_object(int sock, struct lttng_ust_object_data *data);
149 /* Release handle returned by create session. */
150 int ustctl_release_handle(int sock, int handle);
151
152 #endif /* _LTTNG_UST_CTL_H */
This page took 0.044388 seconds and 4 git commands to generate.