Commit | Line | Data |
---|---|---|
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 | ||
b0c4126f | 24 | #define _LGPL_SOURCE |
99054cee | 25 | #include <linux/limits.h> |
b6bf28ec | 26 | #include <errno.h> |
518d7abb | 27 | #include <ust/kcompat/kcompat.h> |
518d7abb | 28 | #include <ust/core.h> |
205f7ca7 DG |
29 | #include <urcu/list.h> |
30 | #include <urcu/urcu_ref.h> | |
31 | ||
99054cee | 32 | #define EVENTS_PER_CHANNEL 65536 |
204141ee | 33 | #define MAX_CPUS 32 |
99054cee | 34 | |
b73a4c47 | 35 | struct ust_trace; |
99054cee | 36 | |
b5b073e2 PMF |
37 | struct ust_buffer; |
38 | ||
39 | struct ust_channel { | |
99054cee | 40 | /* First 32 bytes cache-hot cacheline */ |
b73a4c47 | 41 | struct ust_trace *trace; |
204141ee PMF |
42 | int *buf_struct_shmids; |
43 | struct ust_buffer **buf; | |
99054cee | 44 | int overwrite:1; |
8649cd59 PMF |
45 | /* whether collection is requested upon trace start */ |
46 | int request_collection:1; | |
99054cee PMF |
47 | int active:1; |
48 | unsigned int n_subbufs_order; | |
49 | unsigned long commit_count_mask; /* | |
50 | * Commit count mask, removing | |
51 | * the MSBs corresponding to | |
52 | * bits used to represent the | |
53 | * subbuffer index. | |
54 | */ | |
55 | /* End of first 32 bytes cacheline */ | |
56 | ||
205f7ca7 | 57 | struct urcu_ref urcu_ref; /* Channel transport reference count */ |
b5b073e2 PMF |
58 | size_t subbuf_size; |
59 | int subbuf_size_order; | |
99054cee PMF |
60 | unsigned int subbuf_cnt; |
61 | const char *channel_name; | |
204141ee | 62 | int n_cpus; |
b5b073e2 PMF |
63 | |
64 | u32 version; | |
65 | size_t alloc_size; | |
0222e121 | 66 | struct cds_list_head list; |
99054cee PMF |
67 | } ____cacheline_aligned; |
68 | ||
69 | struct ltt_channel_setting { | |
70 | unsigned int subbuf_size; | |
71 | unsigned int subbuf_cnt; | |
205f7ca7 | 72 | struct urcu_ref urcu_ref; /* Number of references to structure content */ |
0222e121 | 73 | struct cds_list_head list; |
99054cee PMF |
74 | unsigned int index; /* index of channel in trace channel array */ |
75 | u16 free_event_id; /* Next event ID to allocate */ | |
76 | char name[PATH_MAX]; | |
77 | }; | |
78 | ||
064842c6 PMF |
79 | extern int ltt_channels_register(const char *name); |
80 | extern int ltt_channels_unregister(const char *name); | |
81 | extern int ltt_channels_set_default(const char *name, | |
99054cee PMF |
82 | unsigned int subbuf_size, |
83 | unsigned int subbuf_cnt); | |
064842c6 PMF |
84 | extern const char *ltt_channels_get_name_from_index(unsigned int index); |
85 | extern int ltt_channels_get_index_from_name(const char *name); | |
b5b073e2 | 86 | extern struct ust_channel *ltt_channels_trace_alloc(unsigned int *nr_channels, |
99054cee | 87 | int overwrite, |
8649cd59 | 88 | int request_collection, |
99054cee | 89 | int active); |
b5b073e2 | 90 | extern void ltt_channels_trace_free(struct ust_channel *channels); |
064842c6 PMF |
91 | extern int _ltt_channels_get_event_id(const char *channel, const char *name); |
92 | extern int ltt_channels_get_event_id(const char *channel, const char *name); | |
99054cee | 93 | |
8649cd59 PMF |
94 | extern int ust_channels_overwrite_by_default; |
95 | extern int ust_channels_request_collection_by_default; | |
96 | ||
23e47a47 | 97 | #endif /* UST_CHANNELS_H */ |