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 void lttng_ustctl_flush_buffer(struct lttng_consumer_stream
*stream
,
45 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream
*stream
,
47 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream
*stream
);
48 void lttng_ustconsumer_close_all_metadata(struct lttng_ht
*ht
);
49 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel
*metadata
);
50 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream
*stream
);
51 int lttng_ustconsumer_recv_metadata(int sock
, uint64_t key
, uint64_t offset
,
52 uint64_t len
, uint64_t version
,
53 struct lttng_consumer_channel
*channel
, int timer
, int wait
);
54 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data
*ctx
,
55 struct lttng_consumer_channel
*channel
, int timer
, int wait
);
56 enum sync_metadata_status
lttng_ustconsumer_sync_metadata(
57 struct lttng_consumer_local_data
*ctx
,
58 struct lttng_consumer_stream
*metadata
);
59 void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream
*stream
,
61 void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream
*stream
);
62 int lttng_ustconsumer_get_current_timestamp(
63 struct lttng_consumer_stream
*stream
, uint64_t *ts
);
64 int lttng_ustconsumer_get_sequence_number(
65 struct lttng_consumer_stream
*stream
, uint64_t *seq
);
67 #else /* HAVE_LIBLTTNG_UST_CTL */
70 ssize_t
lttng_ustconsumer_on_read_subbuffer_mmap(
71 struct lttng_consumer_local_data
*ctx
,
72 struct lttng_consumer_stream
*stream
, unsigned long len
,
73 unsigned long padding
)
79 ssize_t
lttng_ustconsumer_on_read_subbuffer_splice(
80 struct lttng_consumer_local_data
*ctx
,
81 struct lttng_consumer_stream
*uststream
, unsigned long len
,
82 unsigned long padding
)
88 int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream
*stream
)
94 int lttng_ustconsumer_sample_snapshot_positions(
95 struct lttng_consumer_stream
*stream
)
101 int lttng_ustconsumer_get_produced_snapshot(
102 struct lttng_consumer_stream
*stream
, unsigned long *pos
)
108 int lttng_ustconsumer_get_consumed_snapshot(
109 struct lttng_consumer_stream
*stream
, unsigned long *pos
)
115 int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data
*ctx
,
116 int sock
, struct pollfd
*consumer_sockpoll
)
122 int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel
*chan
)
128 void lttng_ustconsumer_del_channel(struct lttng_consumer_channel
*chan
)
133 void lttng_ustconsumer_free_channel(struct lttng_consumer_channel
*chan
)
138 int lttng_ustconsumer_add_stream(struct lttng_consumer_stream
*stream
)
144 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream
*stream
)
149 int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream
*stream
,
150 struct lttng_consumer_local_data
*ctx
)
156 int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream
*stream
)
162 void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream
*stream
)
167 int lttng_ustctl_get_mmap_read_offset(struct lttng_consumer_stream
*stream
,
173 int lttng_ustconsumer_data_pending(struct lttng_consumer_stream
*stream
)
178 void *lttng_ustctl_get_mmap_base(struct lttng_consumer_stream
*stream
)
183 void lttng_ustctl_flush_buffer(struct lttng_consumer_stream
*stream
,
188 void lttng_ustconsumer_close_all_metadata(struct lttng_ht
*ht
)
192 void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel
*metadata
)
196 void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream
*stream
)
200 int lttng_ustconsumer_recv_metadata(int sock
, uint64_t key
, uint64_t offset
,
201 uint64_t len
, uint64_t version
,
202 struct lttng_consumer_channel
*channel
, int timer
)
207 int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data
*ctx
,
208 struct lttng_consumer_channel
*channel
, int timer
, int wait
)
213 enum sync_metadata_status
lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data
*ctx
,
214 struct lttng_consumer_stream
*metadata
)
216 return SYNC_METADATA_STATUS_ERROR
;
219 void lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream
*stream
,
224 void lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream
*stream
)
228 int lttng_ustconsumer_get_current_timestamp(
229 struct lttng_consumer_stream
*stream
, uint64_t *ts
)
234 int lttng_ustconsumer_get_sequence_number(
235 struct lttng_consumer_stream
*stream
, uint64_t *seq
)
240 int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream
*stream
,
245 #endif /* HAVE_LIBLTTNG_UST_CTL */
247 #endif /* _LTTNG_USTCONSUMER_H */