2 * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; only version 2
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef _LTTNG_UST_CTL_H
21 #define _LTTNG_UST_CTL_H
23 #include <lttng/ust-abi.h>
25 struct ustctl_tracepoint_iter
{
26 char name
[LTTNG_UST_SYM_NAME_LEN
]; /* provider:name */
27 char loglevel
[LTTNG_UST_SYM_NAME_LEN
]; /* provider:loglevel */
28 int64_t loglevel_value
;
31 int ustctl_register_done(int sock
);
32 int ustctl_create_session(int sock
);
33 int ustctl_open_metadata(int sock
, int session_handle
,
34 struct lttng_ust_channel_attr
*chops
,
35 struct lttng_ust_object_data
**metadata_data
);
36 int ustctl_create_channel(int sock
, int session_handle
,
37 struct lttng_ust_channel_attr
*chops
,
38 struct lttng_ust_object_data
**channel_data
);
39 int ustctl_create_stream(int sock
, struct lttng_ust_object_data
*channel_data
,
40 struct lttng_ust_object_data
**stream_data
);
41 int ustctl_create_event(int sock
, struct lttng_ust_event
*ev
,
42 struct lttng_ust_object_data
*channel_data
,
43 struct lttng_ust_object_data
**event_data
);
44 int ustctl_add_context(int sock
, struct lttng_ust_context
*ctx
,
45 struct lttng_ust_object_data
*obj_data
,
46 struct lttng_ust_object_data
**context_data
);
48 int ustctl_enable(int sock
, struct lttng_ust_object_data
*object
);
49 int ustctl_disable(int sock
, struct lttng_ust_object_data
*object
);
50 int ustctl_start_session(int sock
, int handle
);
51 int ustctl_stop_session(int sock
, int handle
);
54 * ustctl_tracepoint_list returns a tracepoint list handle, or negative
57 int ustctl_tracepoint_list(int sock
);
59 * ustctl_tracepoint_list_get is used to iterate on the tp list
60 * handle. End is iteration is reached when -ENOENT is returned.
62 int ustctl_tracepoint_list_get(int sock
, int tp_list_handle
,
63 struct ustctl_tracepoint_iter
*iter
);
65 int ustctl_tracer_version(int sock
, struct lttng_ust_tracer_version
*v
);
66 int ustctl_wait_quiescent(int sock
);
68 /* not implemented yet */
69 struct lttng_ust_calibrate
;
70 int ustctl_calibrate(int sock
, struct lttng_ust_calibrate
*calibrate
);
73 * Map channel lttng_ust_shm_handle and add streams. Typically performed by the
74 * consumer to map the objects into its memory space.
76 struct lttng_ust_shm_handle
*ustctl_map_channel(struct lttng_ust_object_data
*chan_data
);
77 int ustctl_add_stream(struct lttng_ust_shm_handle
*lttng_ust_shm_handle
,
78 struct lttng_ust_object_data
*stream_data
);
80 * Note: the lttng_ust_object_data from which the lttng_ust_shm_handle is derived can only
81 * be released after unmapping the handle.
83 void ustctl_unmap_channel(struct lttng_ust_shm_handle
*lttng_ust_shm_handle
);
85 /* Buffer operations */
87 struct lttng_ust_shm_handle
;
88 struct lttng_ust_lib_ring_buffer
;
90 /* Open/close stream buffers for read */
91 struct lttng_ust_lib_ring_buffer
*ustctl_open_stream_read(struct lttng_ust_shm_handle
*handle
,
93 void ustctl_close_stream_read(struct lttng_ust_shm_handle
*handle
,
94 struct lttng_ust_lib_ring_buffer
*buf
);
96 /* For mmap mode, readable without "get" operation */
97 int ustctl_get_mmap_len(struct lttng_ust_shm_handle
*handle
,
98 struct lttng_ust_lib_ring_buffer
*buf
,
100 int ustctl_get_max_subbuf_size(struct lttng_ust_shm_handle
*handle
,
101 struct lttng_ust_lib_ring_buffer
*buf
,
105 * For mmap mode, operate on the current packet (between get/put or
106 * get_next/put_next).
108 void *ustctl_get_mmap_base(struct lttng_ust_shm_handle
*handle
,
109 struct lttng_ust_lib_ring_buffer
*buf
);
110 int ustctl_get_mmap_read_offset(struct lttng_ust_shm_handle
*handle
,
111 struct lttng_ust_lib_ring_buffer
*buf
, unsigned long *off
);
112 int ustctl_get_subbuf_size(struct lttng_ust_shm_handle
*handle
,
113 struct lttng_ust_lib_ring_buffer
*buf
, unsigned long *len
);
114 int ustctl_get_padded_subbuf_size(struct lttng_ust_shm_handle
*handle
,
115 struct lttng_ust_lib_ring_buffer
*buf
, unsigned long *len
);
116 int ustctl_get_next_subbuf(struct lttng_ust_shm_handle
*handle
,
117 struct lttng_ust_lib_ring_buffer
*buf
);
118 int ustctl_put_next_subbuf(struct lttng_ust_shm_handle
*handle
,
119 struct lttng_ust_lib_ring_buffer
*buf
);
123 int ustctl_snapshot(struct lttng_ust_shm_handle
*handle
,
124 struct lttng_ust_lib_ring_buffer
*buf
);
125 int ustctl_snapshot_get_consumed(struct lttng_ust_shm_handle
*handle
,
126 struct lttng_ust_lib_ring_buffer
*buf
, unsigned long *pos
);
127 int ustctl_snapshot_get_produced(struct lttng_ust_shm_handle
*handle
,
128 struct lttng_ust_lib_ring_buffer
*buf
, unsigned long *pos
);
129 int ustctl_get_subbuf(struct lttng_ust_shm_handle
*handle
,
130 struct lttng_ust_lib_ring_buffer
*buf
, unsigned long *pos
);
131 int ustctl_put_subbuf(struct lttng_ust_shm_handle
*handle
,
132 struct lttng_ust_lib_ring_buffer
*buf
);
134 void ustctl_flush_buffer(struct lttng_ust_shm_handle
*handle
,
135 struct lttng_ust_lib_ring_buffer
*buf
,
136 int producer_active
);
138 /* Release object created by members of this API */
139 int ustctl_release_object(int sock
, struct lttng_ust_object_data
*data
);
141 #endif /* _LTTNG_UST_CTL_H */