2 * Copyright (C) 2011 Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 * SPDX-License-Identifier: GPL-2.0-only
9 #ifndef _LTTNG_USTCONSUMER_H
10 #define _LTTNG_USTCONSUMER_H
14 #include <common/consumer/consumer.h>
17 #ifdef HAVE_LIBLTTNG_UST_CTL
19 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream
*stream
);
20 int lttng_ustconsumer_sample_snapshot_positions(
21 struct lttng_consumer_stream
*stream
);
23 int lttng_ustconsumer_get_produced_snapshot(
24 struct lttng_consumer_stream
*stream
, unsigned long *pos
);
25 int lttng_ustconsumer_get_consumed_snapshot(
26 struct lttng_consumer_stream
*stream
, unsigned long *pos
);
28 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data
*ctx
,
29 int sock
, struct pollfd
*consumer_sockpoll
);
31 extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel
*chan
);
32 extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel
*chan
);
33 extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel
*chan
);
34 extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream
*stream
);
35 extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream
*stream
);
37 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream
*stream
,
38 struct lttng_consumer_local_data
*ctx
);
39 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream
*stream
);
41 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream
*stream
);
43 int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream
*stream
,
45 void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream
*stream
);
46 void lttng_ustctl_flush_buffer(struct lttng_consumer_stream
*stream
,
48 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream
*stream
,
50 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream
*stream
);
51 void lttng_ustconsumer_close_all_metadata(struct lttng_ht
*ht
);
52 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel
*metadata
);
53 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream
*stream
);
54 int lttng_ustconsumer_recv_metadata(int sock
, uint64_t key
, uint64_t offset
,
55 uint64_t len
, uint64_t version
,
56 struct lttng_consumer_channel
*channel
, int timer
, int wait
);
57 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data
*ctx
,
58 struct lttng_consumer_channel
*channel
, int timer
, int wait
);
59 int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data
*ctx
,
60 struct lttng_consumer_stream
*metadata
);
61 void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream
*stream
,
63 void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream
*stream
);
64 int lttng_ustconsumer_get_current_timestamp(
65 struct lttng_consumer_stream
*stream
, uint64_t *ts
);
66 int lttng_ustconsumer_get_sequence_number(
67 struct lttng_consumer_stream
*stream
, uint64_t *seq
);
69 #else /* HAVE_LIBLTTNG_UST_CTL */
72 ssize_t
lttng_ustconsumer_on_read_subbuffer_mmap(
73 struct lttng_consumer_local_data
*ctx
,
74 struct lttng_consumer_stream
*stream
, unsigned long len
,
75 unsigned long padding
)
81 ssize_t
lttng_ustconsumer_on_read_subbuffer_splice(
82 struct lttng_consumer_local_data
*ctx
,
83 struct lttng_consumer_stream
*uststream
, unsigned long len
,
84 unsigned long padding
)
90 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream
*stream
)
96 int lttng_ustconsumer_sample_snapshot_positions(
97 struct lttng_consumer_stream
*stream
)
103 int lttng_ustconsumer_get_produced_snapshot(
104 struct lttng_consumer_stream
*stream
, unsigned long *pos
)
110 int lttng_ustconsumer_get_consumed_snapshot(
111 struct lttng_consumer_stream
*stream
, unsigned long *pos
)
117 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data
*ctx
,
118 int sock
, struct pollfd
*consumer_sockpoll
)
124 int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel
*chan
)
130 void lttng_ustconsumer_del_channel(struct lttng_consumer_channel
*chan
)
135 void lttng_ustconsumer_free_channel(struct lttng_consumer_channel
*chan
)
140 int lttng_ustconsumer_add_stream(struct lttng_consumer_stream
*stream
)
146 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream
*stream
)
151 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream
*stream
,
152 struct lttng_consumer_local_data
*ctx
)
158 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream
*stream
)
164 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream
*stream
)
169 int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream
*stream
,
175 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream
*stream
)
180 void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream
*stream
)
185 void lttng_ustctl_flush_buffer(struct lttng_consumer_stream
*stream
,
190 void lttng_ustconsumer_close_all_metadata(struct lttng_ht
*ht
)
194 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel
*metadata
)
198 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream
*stream
)
202 int lttng_ustconsumer_recv_metadata(int sock
, uint64_t key
, uint64_t offset
,
203 uint64_t len
, uint64_t version
,
204 struct lttng_consumer_channel
*channel
, int timer
)
209 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data
*ctx
,
210 struct lttng_consumer_channel
*channel
, int timer
, int wait
)
215 int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data
*ctx
,
216 struct lttng_consumer_stream
*metadata
)
221 void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream
*stream
,
226 void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream
*stream
)
230 int lttng_ustconsumer_get_current_timestamp(
231 struct lttng_consumer_stream
*stream
, uint64_t *ts
)
236 int lttng_ustconsumer_get_sequence_number(
237 struct lttng_consumer_stream
*stream
, uint64_t *seq
)
242 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream
*stream
,
247 #endif /* HAVE_LIBLTTNG_UST_CTL */
249 #endif /* _LTTNG_USTCONSUMER_H */