Commit | Line | Data |
---|---|---|
1239a312 | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2014 David Goulet <dgoulet@efficios.com> |
1239a312 | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: LGPL-2.1-only |
1239a312 | 5 | * |
1239a312 DG |
6 | */ |
7 | ||
8 | #ifndef LTTNG_CHANNEL_H | |
9 | #define LTTNG_CHANNEL_H | |
10 | ||
11 | #include <lttng/domain.h> | |
12 | #include <lttng/event.h> | |
4bd69c5f | 13 | #include <lttng/lttng-export.h> |
5ba3702f | 14 | #include <stdint.h> |
1239a312 DG |
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 { | |
8d5841ea | 27 | int overwrite; /* -1: session default, 1: overwrite, 0: discard */ |
7daee932 | 28 | uint64_t subbuf_size; /* bytes, power of 2 */ |
1239a312 DG |
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 */ | |
67487150 JG |
38 | /* LTTng 2.7 padding limit */ |
39 | uint32_t align_to_64; | |
40 | union { | |
41 | uint64_t padding; | |
42 | void *ptr; | |
43 | } extended; | |
1239a312 DG |
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 | ||
cf0bcb51 JG |
62 | /* |
63 | */ | |
4bd69c5f | 64 | LTTNG_EXPORT extern struct lttng_channel *lttng_channel_create(struct lttng_domain *domain); |
cf0bcb51 JG |
65 | |
66 | /* | |
67 | */ | |
4bd69c5f | 68 | LTTNG_EXPORT extern void lttng_channel_destroy(struct lttng_channel *channel); |
cf0bcb51 | 69 | |
1239a312 DG |
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 | */ | |
4bd69c5f | 78 | LTTNG_EXPORT extern int lttng_list_channels(struct lttng_handle *handle, |
1239a312 DG |
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 | */ | |
4bd69c5f | 88 | LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle, |
1239a312 DG |
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 | */ | |
4bd69c5f | 98 | LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle, |
1239a312 DG |
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 | */ | |
4bd69c5f | 107 | LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *domain, |
1239a312 DG |
108 | struct lttng_channel_attr *attr); |
109 | ||
5ba3702f JG |
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 | */ | |
4bd69c5f | 115 | LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan, |
5ba3702f JG |
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 | */ | |
4bd69c5f | 123 | LTTNG_EXPORT extern int lttng_channel_get_lost_packet_count(struct lttng_channel *chan, |
5ba3702f JG |
124 | uint64_t *lost_packets); |
125 | ||
4bd69c5f | 126 | LTTNG_EXPORT extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan, |
cf0bcb51 JG |
127 | uint64_t *monitor_timer_interval); |
128 | ||
4bd69c5f | 129 | LTTNG_EXPORT extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan, |
cf0bcb51 JG |
130 | uint64_t monitor_timer_interval); |
131 | ||
4bd69c5f | 132 | LTTNG_EXPORT extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan, |
491d1539 MD |
133 | int64_t *blocking_timeout); |
134 | ||
4bd69c5f | 135 | LTTNG_EXPORT extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan, |
491d1539 MD |
136 | int64_t blocking_timeout); |
137 | ||
1239a312 DG |
138 | #ifdef __cplusplus |
139 | } | |
140 | #endif | |
141 | ||
142 | #endif /* LTTNG_CHANNEL_H */ |