1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
3 * lttng-ring-buffer-client.h
5 * LTTng lib ring buffer client template.
7 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 #include <linux/module.h>
11 #include <linux/types.h>
12 #include <lib/bitfield.h>
13 #include <wrapper/trace-clock.h>
14 #include <lttng-events.h>
15 #include <lttng-tracer.h>
16 #include <include/ringbuffer/frontend_types.h>
18 #define LTTNG_COMPACT_EVENT_BITS 5
19 #define LTTNG_COMPACT_TSC_BITS 27
21 static struct lttng_transport lttng_relay_transport
;
24 * Keep the natural field alignment for _each field_ within this structure if
25 * you ever add/remove a field from this header. Packed attribute is not used
26 * because gcc generates poor code on at least powerpc and mips. Don't ever
27 * let gcc add padding between the structure elements.
29 * The guarantee we have with timestamps is that all the events in a
30 * packet are included (inclusive) within the begin/end timestamps of
31 * the packet. Another guarantee we have is that the "timestamp begin",
32 * as well as the event timestamps, are monotonically increasing (never
33 * decrease) when moving forward in a stream (physically). But this
34 * guarantee does not apply to "timestamp end", because it is sampled at
35 * commit time, which is not ordered with respect to space reservation.
38 struct packet_header
{
39 /* Trace packet header */
42 * contains endianness information.
46 uint64_t stream_instance_id
;
49 /* Stream packet context */
50 uint64_t timestamp_begin
; /* Cycle count at subbuffer start */
51 uint64_t timestamp_end
; /* Cycle count at subbuffer end */
52 uint64_t content_size
; /* Size of data in subbuffer */
53 uint64_t packet_size
; /* Subbuffer size (include padding) */
54 uint64_t packet_seq_num
; /* Packet sequence number */
55 unsigned long events_discarded
; /*
56 * Events lost in this subbuffer since
57 * the beginning of the trace.
60 uint32_t cpu_id
; /* CPU id associated with stream */
61 uint8_t header_end
; /* End of header */
65 struct lttng_client_ctx
{
66 size_t packet_context_len
;
67 size_t event_context_len
;
70 static inline notrace u64
lib_ring_buffer_clock_read(struct channel
*chan
)
72 return trace_clock_read64();
76 size_t ctx_get_aligned_size(size_t offset
, struct lttng_ctx
*ctx
,
79 size_t orig_offset
= offset
;
83 offset
+= lib_ring_buffer_align(offset
, ctx
->largest_align
);
85 return offset
- orig_offset
;
89 void ctx_get_struct_size(struct lttng_ctx
*ctx
, size_t *ctx_len
,
90 struct lttng_channel
*chan
, struct lib_ring_buffer_ctx
*bufctx
)
99 for (i
= 0; i
< ctx
->nr_fields
; i
++) {
100 if (ctx
->fields
[i
].get_size
)
101 offset
+= ctx
->fields
[i
].get_size(offset
);
102 if (ctx
->fields
[i
].get_size_arg
)
103 offset
+= ctx
->fields
[i
].get_size_arg(offset
,
104 &ctx
->fields
[i
], bufctx
, chan
);
110 void ctx_record(struct lib_ring_buffer_ctx
*bufctx
,
111 struct lttng_channel
*chan
,
112 struct lttng_ctx
*ctx
)
118 lib_ring_buffer_align_ctx(bufctx
, ctx
->largest_align
);
119 for (i
= 0; i
< ctx
->nr_fields
; i
++)
120 ctx
->fields
[i
].record(&ctx
->fields
[i
], bufctx
, chan
);
124 * record_header_size - Calculate the header size and padding necessary.
125 * @config: ring buffer instance configuration
127 * @offset: offset in the write buffer
128 * @pre_header_padding: padding to add before the header (output)
129 * @ctx: reservation context
131 * Returns the event header size (including padding).
133 * The payload must itself determine its own alignment from the biggest type it
137 size_t record_header_size(const struct lib_ring_buffer_config
*config
,
138 struct channel
*chan
, size_t offset
,
139 size_t *pre_header_padding
,
140 struct lib_ring_buffer_ctx
*ctx
,
141 struct lttng_client_ctx
*client_ctx
)
143 struct lttng_channel
*lttng_chan
= channel_get_private(chan
);
144 struct lttng_probe_ctx
*lttng_probe_ctx
= ctx
->priv
;
145 struct lttng_event
*event
= lttng_probe_ctx
->event
;
146 size_t orig_offset
= offset
;
149 switch (lttng_chan
->header_type
) {
150 case 1: /* compact */
151 padding
= lib_ring_buffer_align(offset
, lttng_alignof(uint32_t));
153 if (!(ctx
->rflags
& (RING_BUFFER_RFLAG_FULL_TSC
| LTTNG_RFLAG_EXTENDED
))) {
154 offset
+= sizeof(uint32_t); /* id and timestamp */
156 /* Minimum space taken by LTTNG_COMPACT_EVENT_BITS id */
157 offset
+= (LTTNG_COMPACT_EVENT_BITS
+ CHAR_BIT
- 1) / CHAR_BIT
;
158 /* Align extended struct on largest member */
159 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint64_t));
160 offset
+= sizeof(uint32_t); /* id */
161 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint64_t));
162 offset
+= sizeof(uint64_t); /* timestamp */
166 padding
= lib_ring_buffer_align(offset
, lttng_alignof(uint16_t));
168 offset
+= sizeof(uint16_t);
169 if (!(ctx
->rflags
& (RING_BUFFER_RFLAG_FULL_TSC
| LTTNG_RFLAG_EXTENDED
))) {
170 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint32_t));
171 offset
+= sizeof(uint32_t); /* timestamp */
173 /* Align extended struct on largest member */
174 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint64_t));
175 offset
+= sizeof(uint32_t); /* id */
176 offset
+= lib_ring_buffer_align(offset
, lttng_alignof(uint64_t));
177 offset
+= sizeof(uint64_t); /* timestamp */
184 offset
+= ctx_get_aligned_size(offset
, lttng_chan
->ctx
,
185 client_ctx
->packet_context_len
);
186 offset
+= ctx_get_aligned_size(offset
, event
->ctx
,
187 client_ctx
->event_context_len
);
189 *pre_header_padding
= padding
;
190 return offset
- orig_offset
;
193 #include <include/ringbuffer/api.h>
196 void lttng_write_event_header_slow(const struct lib_ring_buffer_config
*config
,
197 struct lib_ring_buffer_ctx
*ctx
,
201 * lttng_write_event_header
203 * Writes the event header to the offset (already aligned on 32-bits).
205 * @config: ring buffer instance configuration
206 * @ctx: reservation context
207 * @event_id: event ID
210 void lttng_write_event_header(const struct lib_ring_buffer_config
*config
,
211 struct lib_ring_buffer_ctx
*ctx
,
214 struct lttng_channel
*lttng_chan
= channel_get_private(ctx
->chan
);
215 struct lttng_probe_ctx
*lttng_probe_ctx
= ctx
->priv
;
216 struct lttng_event
*event
= lttng_probe_ctx
->event
;
218 if (unlikely(ctx
->rflags
))
221 switch (lttng_chan
->header_type
) {
222 case 1: /* compact */
224 uint32_t id_time
= 0;
226 bt_bitfield_write(&id_time
, uint32_t,
228 LTTNG_COMPACT_EVENT_BITS
,
230 bt_bitfield_write(&id_time
, uint32_t,
231 LTTNG_COMPACT_EVENT_BITS
,
232 LTTNG_COMPACT_TSC_BITS
,
234 lib_ring_buffer_write(config
, ctx
, &id_time
, sizeof(id_time
));
239 uint32_t timestamp
= (uint32_t) ctx
->tsc
;
240 uint16_t id
= event_id
;
242 lib_ring_buffer_write(config
, ctx
, &id
, sizeof(id
));
243 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint32_t));
244 lib_ring_buffer_write(config
, ctx
, ×tamp
, sizeof(timestamp
));
251 ctx_record(ctx
, lttng_chan
, lttng_chan
->ctx
);
252 ctx_record(ctx
, lttng_chan
, event
->ctx
);
253 lib_ring_buffer_align_ctx(ctx
, ctx
->largest_align
);
258 lttng_write_event_header_slow(config
, ctx
, event_id
);
262 void lttng_write_event_header_slow(const struct lib_ring_buffer_config
*config
,
263 struct lib_ring_buffer_ctx
*ctx
,
266 struct lttng_channel
*lttng_chan
= channel_get_private(ctx
->chan
);
267 struct lttng_probe_ctx
*lttng_probe_ctx
= ctx
->priv
;
268 struct lttng_event
*event
= lttng_probe_ctx
->event
;
270 switch (lttng_chan
->header_type
) {
271 case 1: /* compact */
272 if (!(ctx
->rflags
& (RING_BUFFER_RFLAG_FULL_TSC
| LTTNG_RFLAG_EXTENDED
))) {
273 uint32_t id_time
= 0;
275 bt_bitfield_write(&id_time
, uint32_t,
277 LTTNG_COMPACT_EVENT_BITS
,
279 bt_bitfield_write(&id_time
, uint32_t,
280 LTTNG_COMPACT_EVENT_BITS
,
281 LTTNG_COMPACT_TSC_BITS
, ctx
->tsc
);
282 lib_ring_buffer_write(config
, ctx
, &id_time
, sizeof(id_time
));
285 uint64_t timestamp
= ctx
->tsc
;
287 bt_bitfield_write(&id
, uint8_t,
289 LTTNG_COMPACT_EVENT_BITS
,
291 lib_ring_buffer_write(config
, ctx
, &id
, sizeof(id
));
292 /* Align extended struct on largest member */
293 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint64_t));
294 lib_ring_buffer_write(config
, ctx
, &event_id
, sizeof(event_id
));
295 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint64_t));
296 lib_ring_buffer_write(config
, ctx
, ×tamp
, sizeof(timestamp
));
301 if (!(ctx
->rflags
& (RING_BUFFER_RFLAG_FULL_TSC
| LTTNG_RFLAG_EXTENDED
))) {
302 uint32_t timestamp
= (uint32_t) ctx
->tsc
;
303 uint16_t id
= event_id
;
305 lib_ring_buffer_write(config
, ctx
, &id
, sizeof(id
));
306 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint32_t));
307 lib_ring_buffer_write(config
, ctx
, ×tamp
, sizeof(timestamp
));
310 uint64_t timestamp
= ctx
->tsc
;
312 lib_ring_buffer_write(config
, ctx
, &id
, sizeof(id
));
313 /* Align extended struct on largest member */
314 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint64_t));
315 lib_ring_buffer_write(config
, ctx
, &event_id
, sizeof(event_id
));
316 lib_ring_buffer_align_ctx(ctx
, lttng_alignof(uint64_t));
317 lib_ring_buffer_write(config
, ctx
, ×tamp
, sizeof(timestamp
));
324 ctx_record(ctx
, lttng_chan
, lttng_chan
->ctx
);
325 ctx_record(ctx
, lttng_chan
, event
->ctx
);
326 lib_ring_buffer_align_ctx(ctx
, ctx
->largest_align
);
329 static const struct lib_ring_buffer_config client_config
;
331 static u64
client_ring_buffer_clock_read(struct channel
*chan
)
333 return lib_ring_buffer_clock_read(chan
);
337 size_t client_record_header_size(const struct lib_ring_buffer_config
*config
,
338 struct channel
*chan
, size_t offset
,
339 size_t *pre_header_padding
,
340 struct lib_ring_buffer_ctx
*ctx
,
343 return record_header_size(config
, chan
, offset
,
344 pre_header_padding
, ctx
, client_ctx
);
348 * client_packet_header_size - called on buffer-switch to a new sub-buffer
350 * Return header size without padding after the structure. Don't use packed
351 * structure because gcc generates inefficient code on some architectures
354 static size_t client_packet_header_size(void)
356 return offsetof(struct packet_header
, ctx
.header_end
);
359 static void client_buffer_begin(struct lib_ring_buffer
*buf
, u64 tsc
,
360 unsigned int subbuf_idx
)
362 struct channel
*chan
= buf
->backend
.chan
;
363 struct packet_header
*header
=
364 (struct packet_header
*)
365 lib_ring_buffer_offset_address(&buf
->backend
,
366 subbuf_idx
* chan
->backend
.subbuf_size
);
367 struct lttng_channel
*lttng_chan
= channel_get_private(chan
);
368 struct lttng_session
*session
= lttng_chan
->session
;
370 header
->magic
= CTF_MAGIC_NUMBER
;
371 memcpy(header
->uuid
, session
->uuid
.b
, sizeof(session
->uuid
));
372 header
->stream_id
= lttng_chan
->id
;
373 header
->stream_instance_id
= buf
->backend
.cpu
;
374 header
->ctx
.timestamp_begin
= tsc
;
375 header
->ctx
.timestamp_end
= 0;
376 header
->ctx
.content_size
= ~0ULL; /* for debugging */
377 header
->ctx
.packet_size
= ~0ULL;
378 header
->ctx
.packet_seq_num
= chan
->backend
.num_subbuf
* \
379 buf
->backend
.buf_cnt
[subbuf_idx
].seq_cnt
+ \
381 header
->ctx
.events_discarded
= 0;
382 header
->ctx
.cpu_id
= buf
->backend
.cpu
;
386 * offset is assumed to never be 0 here : never deliver a completely empty
387 * subbuffer. data_size is between 1 and subbuf_size.
389 static void client_buffer_end(struct lib_ring_buffer
*buf
, u64 tsc
,
390 unsigned int subbuf_idx
, unsigned long data_size
)
392 struct channel
*chan
= buf
->backend
.chan
;
393 struct packet_header
*header
=
394 (struct packet_header
*)
395 lib_ring_buffer_offset_address(&buf
->backend
,
396 subbuf_idx
* chan
->backend
.subbuf_size
);
397 unsigned long records_lost
= 0;
399 header
->ctx
.timestamp_end
= tsc
;
400 header
->ctx
.content_size
=
401 (uint64_t) data_size
* CHAR_BIT
; /* in bits */
402 header
->ctx
.packet_size
=
403 (uint64_t) PAGE_ALIGN(data_size
) * CHAR_BIT
; /* in bits */
404 records_lost
+= lib_ring_buffer_get_records_lost_full(&client_config
, buf
);
405 records_lost
+= lib_ring_buffer_get_records_lost_wrap(&client_config
, buf
);
406 records_lost
+= lib_ring_buffer_get_records_lost_big(&client_config
, buf
);
407 header
->ctx
.events_discarded
= records_lost
;
410 static int client_buffer_create(struct lib_ring_buffer
*buf
, void *priv
,
411 int cpu
, const char *name
)
416 static void client_buffer_finalize(struct lib_ring_buffer
*buf
, void *priv
, int cpu
)
420 static struct packet_header
*client_packet_header(
421 const struct lib_ring_buffer_config
*config
,
422 struct lib_ring_buffer
*buf
)
424 return lib_ring_buffer_read_offset_address(&buf
->backend
, 0);
427 static int client_timestamp_begin(const struct lib_ring_buffer_config
*config
,
428 struct lib_ring_buffer
*buf
,
429 uint64_t *timestamp_begin
)
431 struct packet_header
*header
= client_packet_header(config
, buf
);
432 *timestamp_begin
= header
->ctx
.timestamp_begin
;
437 static int client_timestamp_end(const struct lib_ring_buffer_config
*config
,
438 struct lib_ring_buffer
*buf
,
439 uint64_t *timestamp_end
)
441 struct packet_header
*header
= client_packet_header(config
, buf
);
442 *timestamp_end
= header
->ctx
.timestamp_end
;
447 static int client_events_discarded(const struct lib_ring_buffer_config
*config
,
448 struct lib_ring_buffer
*buf
,
449 uint64_t *events_discarded
)
451 struct packet_header
*header
= client_packet_header(config
, buf
);
452 *events_discarded
= header
->ctx
.events_discarded
;
457 static int client_content_size(const struct lib_ring_buffer_config
*config
,
458 struct lib_ring_buffer
*buf
,
459 uint64_t *content_size
)
461 struct packet_header
*header
= client_packet_header(config
, buf
);
462 *content_size
= header
->ctx
.content_size
;
467 static int client_packet_size(const struct lib_ring_buffer_config
*config
,
468 struct lib_ring_buffer
*buf
,
469 uint64_t *packet_size
)
471 struct packet_header
*header
= client_packet_header(config
, buf
);
472 *packet_size
= header
->ctx
.packet_size
;
477 static int client_stream_id(const struct lib_ring_buffer_config
*config
,
478 struct lib_ring_buffer
*buf
,
481 struct channel
*chan
= buf
->backend
.chan
;
482 struct lttng_channel
*lttng_chan
= channel_get_private(chan
);
484 *stream_id
= lttng_chan
->id
;
488 static int client_current_timestamp(const struct lib_ring_buffer_config
*config
,
489 struct lib_ring_buffer
*bufb
,
492 *ts
= config
->cb
.ring_buffer_clock_read(bufb
->backend
.chan
);
497 static int client_sequence_number(const struct lib_ring_buffer_config
*config
,
498 struct lib_ring_buffer
*buf
,
501 struct packet_header
*header
= client_packet_header(config
, buf
);
503 *seq
= header
->ctx
.packet_seq_num
;
509 int client_instance_id(const struct lib_ring_buffer_config
*config
,
510 struct lib_ring_buffer
*buf
,
513 *id
= buf
->backend
.cpu
;
518 static const struct lib_ring_buffer_config client_config
= {
519 .cb
.ring_buffer_clock_read
= client_ring_buffer_clock_read
,
520 .cb
.record_header_size
= client_record_header_size
,
521 .cb
.subbuffer_header_size
= client_packet_header_size
,
522 .cb
.buffer_begin
= client_buffer_begin
,
523 .cb
.buffer_end
= client_buffer_end
,
524 .cb
.buffer_create
= client_buffer_create
,
525 .cb
.buffer_finalize
= client_buffer_finalize
,
527 .tsc_bits
= LTTNG_COMPACT_TSC_BITS
,
528 .alloc
= RING_BUFFER_ALLOC_PER_CPU
,
529 .sync
= RING_BUFFER_SYNC_PER_CPU
,
530 .mode
= RING_BUFFER_MODE_TEMPLATE
,
531 .backend
= RING_BUFFER_PAGE
,
532 .output
= RING_BUFFER_OUTPUT_TEMPLATE
,
533 .oops
= RING_BUFFER_OOPS_CONSISTENCY
,
534 .ipi
= RING_BUFFER_IPI_BARRIER
,
535 .wakeup
= RING_BUFFER_WAKEUP_BY_TIMER
,
539 void release_priv_ops(void *priv_ops
)
541 module_put(THIS_MODULE
);
545 void lttng_channel_destroy(struct channel
*chan
)
547 channel_destroy(chan
);
551 struct channel
*_channel_create(const char *name
,
552 struct lttng_channel
*lttng_chan
, void *buf_addr
,
553 size_t subbuf_size
, size_t num_subbuf
,
554 unsigned int switch_timer_interval
,
555 unsigned int read_timer_interval
)
557 struct channel
*chan
;
559 chan
= channel_create(&client_config
, name
, lttng_chan
, buf_addr
,
560 subbuf_size
, num_subbuf
, switch_timer_interval
,
561 read_timer_interval
);
564 * Ensure this module is not unloaded before we finish
565 * using lttng_relay_transport.ops.
567 if (!try_module_get(THIS_MODULE
)) {
568 printk(KERN_WARNING
"LTT : Can't lock transport module.\n");
571 chan
->backend
.priv_ops
= <tng_relay_transport
.ops
;
572 chan
->backend
.release_priv_ops
= release_priv_ops
;
577 lttng_channel_destroy(chan
);
582 struct lib_ring_buffer
*lttng_buffer_read_open(struct channel
*chan
)
584 struct lib_ring_buffer
*buf
;
587 for_each_channel_cpu(cpu
, chan
) {
588 buf
= channel_get_ring_buffer(&client_config
, chan
, cpu
);
589 if (!lib_ring_buffer_open_read(buf
))
596 int lttng_buffer_has_read_closed_stream(struct channel
*chan
)
598 struct lib_ring_buffer
*buf
;
601 for_each_channel_cpu(cpu
, chan
) {
602 buf
= channel_get_ring_buffer(&client_config
, chan
, cpu
);
603 if (!atomic_long_read(&buf
->active_readers
))
610 void lttng_buffer_read_close(struct lib_ring_buffer
*buf
)
612 lib_ring_buffer_release_read(buf
);
616 int lttng_event_reserve(struct lib_ring_buffer_ctx
*ctx
,
619 struct lttng_channel
*lttng_chan
= channel_get_private(ctx
->chan
);
620 struct lttng_probe_ctx
*lttng_probe_ctx
= ctx
->priv
;
621 struct lttng_event
*event
= lttng_probe_ctx
->event
;
622 struct lttng_client_ctx client_ctx
;
625 cpu
= lib_ring_buffer_get_cpu(&client_config
);
626 if (unlikely(cpu
< 0))
630 /* Compute internal size of context structures. */
631 ctx_get_struct_size(lttng_chan
->ctx
, &client_ctx
.packet_context_len
, lttng_chan
, ctx
);
632 ctx_get_struct_size(event
->ctx
, &client_ctx
.event_context_len
, lttng_chan
, ctx
);
634 switch (lttng_chan
->header_type
) {
635 case 1: /* compact */
637 ctx
->rflags
|= LTTNG_RFLAG_EXTENDED
;
640 if (event_id
> 65534)
641 ctx
->rflags
|= LTTNG_RFLAG_EXTENDED
;
647 ret
= lib_ring_buffer_reserve(&client_config
, ctx
, &client_ctx
);
650 lib_ring_buffer_backend_get_pages(&client_config
, ctx
,
651 &ctx
->backend_pages
);
652 lttng_write_event_header(&client_config
, ctx
, event_id
);
655 lib_ring_buffer_put_cpu(&client_config
);
660 void lttng_event_commit(struct lib_ring_buffer_ctx
*ctx
)
662 lib_ring_buffer_commit(&client_config
, ctx
);
663 lib_ring_buffer_put_cpu(&client_config
);
667 void lttng_event_write(struct lib_ring_buffer_ctx
*ctx
, const void *src
,
670 lib_ring_buffer_write(&client_config
, ctx
, src
, len
);
674 void lttng_event_write_from_user(struct lib_ring_buffer_ctx
*ctx
,
675 const void __user
*src
, size_t len
)
677 lib_ring_buffer_copy_from_user_inatomic(&client_config
, ctx
, src
, len
);
681 void lttng_event_memset(struct lib_ring_buffer_ctx
*ctx
,
684 lib_ring_buffer_memset(&client_config
, ctx
, c
, len
);
688 void lttng_event_strcpy(struct lib_ring_buffer_ctx
*ctx
, const char *src
,
691 lib_ring_buffer_strcpy(&client_config
, ctx
, src
, len
, '#');
695 void lttng_event_strcpy_from_user(struct lib_ring_buffer_ctx
*ctx
,
696 const char __user
*src
, size_t len
)
698 lib_ring_buffer_strcpy_from_user_inatomic(&client_config
, ctx
, src
,
703 wait_queue_head_t
*lttng_get_writer_buf_wait_queue(struct channel
*chan
, int cpu
)
705 struct lib_ring_buffer
*buf
= channel_get_ring_buffer(&client_config
,
707 return &buf
->write_wait
;
711 wait_queue_head_t
*lttng_get_hp_wait_queue(struct channel
*chan
)
713 return &chan
->hp_wait
;
717 int lttng_is_finalized(struct channel
*chan
)
719 return lib_ring_buffer_channel_is_finalized(chan
);
723 int lttng_is_disabled(struct channel
*chan
)
725 return lib_ring_buffer_channel_is_disabled(chan
);
728 static struct lttng_transport lttng_relay_transport
= {
729 .name
= "relay-" RING_BUFFER_MODE_TEMPLATE_STRING
,
730 .owner
= THIS_MODULE
,
732 .channel_create
= _channel_create
,
733 .channel_destroy
= lttng_channel_destroy
,
734 .buffer_read_open
= lttng_buffer_read_open
,
735 .buffer_has_read_closed_stream
=
736 lttng_buffer_has_read_closed_stream
,
737 .buffer_read_close
= lttng_buffer_read_close
,
738 .event_reserve
= lttng_event_reserve
,
739 .event_commit
= lttng_event_commit
,
740 .event_write
= lttng_event_write
,
741 .event_write_from_user
= lttng_event_write_from_user
,
742 .event_memset
= lttng_event_memset
,
743 .event_strcpy
= lttng_event_strcpy
,
744 .event_strcpy_from_user
= lttng_event_strcpy_from_user
,
745 .packet_avail_size
= NULL
, /* Would be racy anyway */
746 .get_writer_buf_wait_queue
= lttng_get_writer_buf_wait_queue
,
747 .get_hp_wait_queue
= lttng_get_hp_wait_queue
,
748 .is_finalized
= lttng_is_finalized
,
749 .is_disabled
= lttng_is_disabled
,
750 .timestamp_begin
= client_timestamp_begin
,
751 .timestamp_end
= client_timestamp_end
,
752 .events_discarded
= client_events_discarded
,
753 .content_size
= client_content_size
,
754 .packet_size
= client_packet_size
,
755 .stream_id
= client_stream_id
,
756 .current_timestamp
= client_current_timestamp
,
757 .sequence_number
= client_sequence_number
,
758 .instance_id
= client_instance_id
,
762 static int __init
lttng_ring_buffer_client_init(void)
764 lttng_transport_register(<tng_relay_transport
);
768 module_init(lttng_ring_buffer_client_init
);
770 static void __exit
lttng_ring_buffer_client_exit(void)
772 lttng_transport_unregister(<tng_relay_transport
);
775 module_exit(lttng_ring_buffer_client_exit
);
777 MODULE_LICENSE("GPL and additional rights");
778 MODULE_AUTHOR("Mathieu Desnoyers <mathieu.desnoyers@efficios.com>");
779 MODULE_DESCRIPTION("LTTng ring buffer " RING_BUFFER_MODE_TEMPLATE_STRING
781 MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION
) "."
782 __stringify(LTTNG_MODULES_MINOR_VERSION
) "."
783 __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION
)
784 LTTNG_MODULES_EXTRAVERSION
);