Port changes from lttng-kt
[ust.git] / libust / channels.h
CommitLineData
23e47a47
PMF
1#ifndef UST_CHANNELS_H
2#define UST_CHANNELS_H
99054cee
PMF
3
4/*
5 * Copyright (C) 2008 Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
6 *
7 * Dynamic tracer channel allocation.
8fc2d8db
PMF
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
99054cee
PMF
22 */
23
24#include <linux/limits.h>
b6bf28ec 25#include <errno.h>
59b161cd 26
fbca6b62 27#include <ust/kernelcompat.h>
79d4d545 28#include <kcompat/kref.h>
99054cee
PMF
29
30#define EVENTS_PER_CHANNEL 65536
204141ee 31#define MAX_CPUS 32
99054cee 32
b73a4c47 33struct ust_trace;
99054cee 34
b5b073e2
PMF
35struct ust_buffer;
36
37struct ust_channel {
99054cee 38 /* First 32 bytes cache-hot cacheline */
b73a4c47 39 struct ust_trace *trace;
204141ee
PMF
40 int *buf_struct_shmids;
41 struct ust_buffer **buf;
99054cee
PMF
42 int overwrite:1;
43 int active:1;
44 unsigned int n_subbufs_order;
45 unsigned long commit_count_mask; /*
46 * Commit count mask, removing
47 * the MSBs corresponding to
48 * bits used to represent the
49 * subbuffer index.
50 */
51 /* End of first 32 bytes cacheline */
52
99054cee 53 struct kref kref; /* Channel transport reference count */
b5b073e2
PMF
54 size_t subbuf_size;
55 int subbuf_size_order;
99054cee
PMF
56 unsigned int subbuf_cnt;
57 const char *channel_name;
204141ee 58 int n_cpus;
b5b073e2
PMF
59
60 u32 version;
61 size_t alloc_size;
62 struct list_head list;
99054cee
PMF
63} ____cacheline_aligned;
64
65struct ltt_channel_setting {
66 unsigned int subbuf_size;
67 unsigned int subbuf_cnt;
68 struct kref kref; /* Number of references to structure content */
69 struct list_head list;
70 unsigned int index; /* index of channel in trace channel array */
71 u16 free_event_id; /* Next event ID to allocate */
72 char name[PATH_MAX];
73};
74
064842c6
PMF
75extern int ltt_channels_register(const char *name);
76extern int ltt_channels_unregister(const char *name);
77extern int ltt_channels_set_default(const char *name,
99054cee
PMF
78 unsigned int subbuf_size,
79 unsigned int subbuf_cnt);
064842c6
PMF
80extern const char *ltt_channels_get_name_from_index(unsigned int index);
81extern int ltt_channels_get_index_from_name(const char *name);
b5b073e2 82extern struct ust_channel *ltt_channels_trace_alloc(unsigned int *nr_channels,
99054cee
PMF
83 int overwrite,
84 int active);
b5b073e2 85extern void ltt_channels_trace_free(struct ust_channel *channels);
064842c6
PMF
86extern int _ltt_channels_get_event_id(const char *channel, const char *name);
87extern int ltt_channels_get_event_id(const char *channel, const char *name);
99054cee 88
23e47a47 89#endif /* UST_CHANNELS_H */
This page took 0.028185 seconds and 4 git commands to generate.