lib: compile liblttng-ctl as C++
[lttng-tools.git] / include / lttng / channel.h
1 /*
2 * Copyright (C) 2014 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #ifndef LTTNG_CHANNEL_H
9 #define LTTNG_CHANNEL_H
10
11 #include <lttng/domain.h>
12 #include <lttng/event.h>
13 #include <lttng/lttng-export.h>
14 #include <stdint.h>
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 /*
21 * Tracer channel attributes. For both kernel and user-space.
22 *
23 * The structures should be initialized to zero before use.
24 */
25 #define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
26 struct lttng_channel_attr {
27 int overwrite; /* -1: session default, 1: overwrite, 0: discard */
28 uint64_t subbuf_size; /* bytes, power of 2 */
29 uint64_t num_subbuf; /* power of 2 */
30 unsigned int switch_timer_interval; /* usec */
31 unsigned int read_timer_interval; /* usec */
32 enum lttng_event_output output; /* splice, mmap */
33 /* LTTng 2.1 padding limit */
34 uint64_t tracefile_size; /* bytes */
35 uint64_t tracefile_count; /* number of tracefiles */
36 /* LTTng 2.3 padding limit */
37 unsigned int live_timer_interval; /* usec */
38 /* LTTng 2.7 padding limit */
39 uint32_t align_to_64;
40 union {
41 uint64_t padding;
42 void *ptr;
43 } extended;
44
45 char padding[LTTNG_CHANNEL_ATTR_PADDING1];
46 };
47
48 /*
49 * Channel information structure. For both kernel and user-space.
50 *
51 * The structures should be initialized to zero before use.
52 */
53 #define LTTNG_CHANNEL_PADDING1 16
54 struct lttng_channel {
55 char name[LTTNG_SYMBOL_NAME_LEN];
56 uint32_t enabled;
57 struct lttng_channel_attr attr;
58
59 char padding[LTTNG_CHANNEL_PADDING1];
60 };
61
62 /*
63 */
64 LTTNG_EXPORT extern struct lttng_channel *lttng_channel_create(struct lttng_domain *domain);
65
66 /*
67 */
68 LTTNG_EXPORT extern void lttng_channel_destroy(struct lttng_channel *channel);
69
70 /*
71 * List the channel(s) of a session.
72 *
73 * The handle CAN NOT be NULL.
74 *
75 * Return the size (number of entries) of the "lttng_channel" array. Caller
76 * must free channels. On error, a negative LTTng error code is returned.
77 */
78 LTTNG_EXPORT extern int lttng_list_channels(struct lttng_handle *handle,
79 struct lttng_channel **channels);
80
81 /*
82 * Create or enable a channel.
83 *
84 * The chan and handle params can not be NULL.
85 *
86 * Return 0 on success else a negative LTTng error code.
87 */
88 LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle,
89 struct lttng_channel *chan);
90
91 /*
92 * Disable channel.
93 *
94 * Name and handle CAN NOT be NULL.
95 *
96 * Return 0 on success else a negative LTTng error code.
97 */
98 LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle,
99 const char *name);
100
101 /*
102 * Set the default channel attributes for a specific domain and an allocated
103 * lttng_channel_attr pointer.
104 *
105 * If one or both arguments are NULL, nothing happens.
106 */
107 LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *domain,
108 struct lttng_channel_attr *attr);
109
110 /*
111 * Get the discarded event count of a specific LTTng channel.
112 *
113 * Returns 0 on success, or a negative LTTng error code on error.
114 */
115 LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan,
116 uint64_t *discarded_events);
117
118 /*
119 * Get the lost packet count of a specific LTTng channel.
120 *
121 * Returns 0 on success, or a negative LTTng error code on error.
122 */
123 LTTNG_EXPORT extern int lttng_channel_get_lost_packet_count(struct lttng_channel *chan,
124 uint64_t *lost_packets);
125
126 LTTNG_EXPORT extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan,
127 uint64_t *monitor_timer_interval);
128
129 LTTNG_EXPORT extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan,
130 uint64_t monitor_timer_interval);
131
132 LTTNG_EXPORT extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan,
133 int64_t *blocking_timeout);
134
135 LTTNG_EXPORT extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan,
136 int64_t blocking_timeout);
137
138 #ifdef __cplusplus
139 }
140 #endif
141
142 #endif /* LTTNG_CHANNEL_H */
This page took 0.031821 seconds and 4 git commands to generate.