Commit | Line | Data |
---|---|---|
f3105c67 MD |
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 | |
6 | * modify it under the terms of the GNU General Public License | |
7 | * as published by the Free Software Foundation; only version 2 | |
8 | * of the License. | |
9 | * | |
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. | |
14 | * | |
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. | |
18 | */ | |
19 | ||
20 | #ifndef _LTTNG_UST_CTL_H | |
21 | #define _LTTNG_UST_CTL_H | |
22 | ||
23 | #include <ust/lttng-ust-abi.h> | |
24 | ||
25 | /* | |
26 | * Tracer channel attributes. | |
27 | */ | |
28 | struct lttng_ust_channel_attr { | |
29 | int overwrite; /* 1: overwrite, 0: discard */ | |
30 | uint64_t subbuf_size; /* bytes */ | |
31 | uint64_t num_subbuf; /* power of 2 */ | |
32 | unsigned int switch_timer_interval; /* usec */ | |
33 | unsigned int read_timer_interval; /* usec */ | |
34 | enum lttng_ust_output output; /* splice, mmap */ | |
35 | }; | |
36 | ||
61f02aea | 37 | struct lttng_ust_object_data { |
f3105c67 MD |
38 | int handle; |
39 | int shm_fd; | |
40 | int wait_fd; | |
41 | uint64_t memory_map_size; | |
42 | }; | |
43 | ||
1c5e467e | 44 | int ustctl_register_done(int sock); |
f3105c67 MD |
45 | int ustctl_create_session(int sock); |
46 | int ustctl_open_metadata(int sock, int session_handle, | |
47 | struct lttng_ust_channel_attr *chops, | |
61f02aea | 48 | struct lttng_ust_object_data **metadata_data); |
f3105c67 MD |
49 | int ustctl_create_channel(int sock, int session_handle, |
50 | struct lttng_ust_channel_attr *chops, | |
61f02aea MD |
51 | struct lttng_ust_object_data **channel_data); |
52 | int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data, | |
53 | struct lttng_ust_object_data **stream_data); | |
f3105c67 | 54 | int ustctl_create_event(int sock, struct lttng_ust_event *ev, |
61f02aea MD |
55 | struct lttng_ust_object_data *channel_data, |
56 | struct lttng_ust_object_data **event_data); | |
f3105c67 | 57 | int ustctl_add_context(int sock, struct lttng_ust_context *ctx, |
61f02aea MD |
58 | struct lttng_ust_object_data *obj_data, |
59 | struct lttng_ust_object_data **context_data); | |
f3105c67 | 60 | |
61f02aea MD |
61 | int ustctl_enable(int sock, struct lttng_ust_object_data *object); |
62 | int ustctl_disable(int sock, struct lttng_ust_object_data *object); | |
4a6ca058 MD |
63 | int ustctl_start_session(int sock, int handle); |
64 | int ustctl_stop_session(int sock, int handle); | |
f3105c67 MD |
65 | |
66 | int ustctl_tracepoint_list(int sock); /* not implemented yet */ | |
67 | int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v); | |
68 | int ustctl_wait_quiescent(int sock); | |
69 | ||
43861eab | 70 | /* Flush each buffers in this channel */ |
61f02aea | 71 | int ustctl_flush_buffer(int sock, struct lttng_ust_object_data *channel_data); |
43861eab | 72 | |
f3105c67 MD |
73 | /* not implemented yet */ |
74 | struct lttng_ust_calibrate; | |
75 | int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate); | |
76 | ||
f3105c67 MD |
77 | /* |
78 | * Map channel shm_handle and add streams. Typically performed by the | |
79 | * consumer to map the objects into its memory space. | |
80 | */ | |
61f02aea | 81 | struct shm_handle *ustctl_map_channel(struct lttng_ust_object_data *chan_data); |
f3105c67 | 82 | int ustctl_add_stream(struct shm_handle *shm_handle, |
61f02aea | 83 | struct lttng_ust_object_data *stream_data); |
5224b5c8 | 84 | /* |
61f02aea | 85 | * Note: the lttng_ust_object_data from which the shm_handle is derived can only |
5224b5c8 MD |
86 | * be released after unmapping the handle. |
87 | */ | |
88 | void ustctl_unmap_channel(struct shm_handle *shm_handle); | |
f3105c67 MD |
89 | |
90 | /* Buffer operations */ | |
91 | ||
92 | struct shm_handle; | |
93 | struct lib_ring_buffer; | |
94 | ||
6e922b24 MD |
95 | /* Open/close stream buffers for read */ |
96 | struct lib_ring_buffer *ustctl_open_stream_read(struct shm_handle *handle, | |
97 | int cpu); | |
98 | void ustctl_close_stream_read(struct shm_handle *handle, | |
99 | struct lib_ring_buffer *buf); | |
100 | ||
f3105c67 MD |
101 | /* For mmap mode, readable without "get" operation */ |
102 | int ustctl_get_mmap_len(struct shm_handle *handle, | |
103 | struct lib_ring_buffer *buf, | |
104 | unsigned long *len); | |
105 | int ustctl_get_max_subbuf_size(struct shm_handle *handle, | |
106 | struct lib_ring_buffer *buf, | |
107 | unsigned long *len); | |
108 | ||
109 | /* | |
110 | * For mmap mode, operate on the current packet (between get/put or | |
111 | * get_next/put_next). | |
112 | */ | |
9095efe9 MD |
113 | void *ustctl_get_mmap_base(struct shm_handle *handle, |
114 | struct lib_ring_buffer *buf); | |
f3105c67 MD |
115 | int ustctl_get_mmap_read_offset(struct shm_handle *handle, |
116 | struct lib_ring_buffer *buf, unsigned long *off); | |
117 | int ustctl_get_subbuf_size(struct shm_handle *handle, | |
118 | struct lib_ring_buffer *buf, unsigned long *len); | |
119 | int ustctl_get_padded_subbuf_size(struct shm_handle *handle, | |
120 | struct lib_ring_buffer *buf, unsigned long *len); | |
121 | int ustctl_get_next_subbuf(struct shm_handle *handle, | |
122 | struct lib_ring_buffer *buf); | |
123 | int ustctl_put_next_subbuf(struct shm_handle *handle, | |
124 | struct lib_ring_buffer *buf); | |
125 | ||
126 | /* snapshot */ | |
127 | ||
128 | int ustctl_snapshot(struct shm_handle *handle, | |
129 | struct lib_ring_buffer *buf); | |
130 | int ustctl_snapshot_get_consumed(struct shm_handle *handle, | |
131 | struct lib_ring_buffer *buf, unsigned long *pos); | |
132 | int ustctl_snapshot_get_produced(struct shm_handle *handle, | |
133 | struct lib_ring_buffer *buf, unsigned long *pos); | |
134 | int ustctl_get_subbuf(struct shm_handle *handle, | |
135 | struct lib_ring_buffer *buf, unsigned long *pos); | |
136 | int ustctl_put_subbuf(struct shm_handle *handle, | |
137 | struct lib_ring_buffer *buf); | |
138 | ||
139 | /* Release object created by members of this API */ | |
61f02aea | 140 | void release_object(int sock, struct lttng_ust_object_data *data); |
f3105c67 MD |
141 | |
142 | #endif /* _LTTNG_UST_CTL_H */ |