Clean-up: run format-cpp on the tree
[lttng-tools.git] / include / lttng / channel.h
CommitLineData
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>
28f23191 14
5ba3702f 15#include <stdint.h>
1239a312
DG
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*
22 * Tracer channel attributes. For both kernel and user-space.
23 *
24 * The structures should be initialized to zero before use.
25 */
28f23191 26#define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
1239a312 27struct lttng_channel_attr {
28f23191
JG
28 int overwrite; /* -1: session default, 1: overwrite, 0: discard */
29 uint64_t subbuf_size; /* bytes, power of 2 */
30 uint64_t num_subbuf; /* power of 2 */
1239a312 31 unsigned int switch_timer_interval; /* usec */
28f23191
JG
32 unsigned int read_timer_interval; /* usec */
33 enum lttng_event_output output; /* splice, mmap */
1239a312 34 /* LTTng 2.1 padding limit */
28f23191
JG
35 uint64_t tracefile_size; /* bytes */
36 uint64_t tracefile_count; /* number of tracefiles */
1239a312 37 /* LTTng 2.3 padding limit */
28f23191 38 unsigned int live_timer_interval; /* usec */
67487150
JG
39 /* LTTng 2.7 padding limit */
40 uint32_t align_to_64;
41 union {
42 uint64_t padding;
43 void *ptr;
44 } extended;
1239a312
DG
45
46 char padding[LTTNG_CHANNEL_ATTR_PADDING1];
47};
48
49/*
50 * Channel information structure. For both kernel and user-space.
51 *
52 * The structures should be initialized to zero before use.
53 */
28f23191 54#define LTTNG_CHANNEL_PADDING1 16
1239a312
DG
55struct lttng_channel {
56 char name[LTTNG_SYMBOL_NAME_LEN];
57 uint32_t enabled;
58 struct lttng_channel_attr attr;
59
60 char padding[LTTNG_CHANNEL_PADDING1];
61};
62
cf0bcb51
JG
63/*
64 */
4bd69c5f 65LTTNG_EXPORT extern struct lttng_channel *lttng_channel_create(struct lttng_domain *domain);
cf0bcb51
JG
66
67/*
68 */
4bd69c5f 69LTTNG_EXPORT extern void lttng_channel_destroy(struct lttng_channel *channel);
cf0bcb51 70
1239a312
DG
71/*
72 * List the channel(s) of a session.
73 *
74 * The handle CAN NOT be NULL.
75 *
76 * Return the size (number of entries) of the "lttng_channel" array. Caller
77 * must free channels. On error, a negative LTTng error code is returned.
78 */
4bd69c5f 79LTTNG_EXPORT extern int lttng_list_channels(struct lttng_handle *handle,
28f23191 80 struct lttng_channel **channels);
1239a312
DG
81
82/*
83 * Create or enable a channel.
84 *
85 * The chan and handle params can not be NULL.
86 *
87 * Return 0 on success else a negative LTTng error code.
88 */
4bd69c5f 89LTTNG_EXPORT extern int lttng_enable_channel(struct lttng_handle *handle,
28f23191 90 struct lttng_channel *chan);
1239a312
DG
91
92/*
93 * Disable channel.
94 *
95 * Name and handle CAN NOT be NULL.
96 *
97 * Return 0 on success else a negative LTTng error code.
98 */
28f23191 99LTTNG_EXPORT extern int lttng_disable_channel(struct lttng_handle *handle, const char *name);
1239a312
DG
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 107LTTNG_EXPORT extern void lttng_channel_set_default_attr(struct lttng_domain *domain,
28f23191 108 struct lttng_channel_attr *attr);
1239a312 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 115LTTNG_EXPORT extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan,
28f23191 116 uint64_t *discarded_events);
5ba3702f
JG
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 123LTTNG_EXPORT extern int lttng_channel_get_lost_packet_count(struct lttng_channel *chan,
28f23191 124 uint64_t *lost_packets);
5ba3702f 125
4bd69c5f 126LTTNG_EXPORT extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan,
28f23191 127 uint64_t *monitor_timer_interval);
cf0bcb51 128
4bd69c5f 129LTTNG_EXPORT extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan,
28f23191 130 uint64_t monitor_timer_interval);
cf0bcb51 131
4bd69c5f 132LTTNG_EXPORT extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan,
28f23191 133 int64_t *blocking_timeout);
491d1539 134
4bd69c5f 135LTTNG_EXPORT extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan,
28f23191 136 int64_t blocking_timeout);
491d1539 137
1239a312
DG
138#ifdef __cplusplus
139}
140#endif
141
142#endif /* LTTNG_CHANNEL_H */
This page took 0.049878 seconds and 4 git commands to generate.