Commit | Line | Data |
---|---|---|
fda89c9b DG |
1 | /* |
2 | * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca> | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU General Public License | |
82a3637f DG |
6 | * as published by the Free Software Foundation; only version 2 |
7 | * of the License. | |
fda89c9b DG |
8 | * |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | */ | |
18 | ||
19 | #ifndef _LTT_TRACE_H | |
20 | #define _LTT_TRACE_H | |
21 | ||
9e78d6ae DG |
22 | #include <limits.h> |
23 | #include <urcu/list.h> | |
d4a2a84a | 24 | |
f3ed775e DG |
25 | #include <lttng/lttng.h> |
26 | ||
27 | #include "lttng-kernel.h" | |
54012638 | 28 | |
20fe2104 DG |
29 | /* Kernel event list */ |
30 | struct ltt_kernel_event_list { | |
31 | struct cds_list_head head; | |
32 | }; | |
33 | ||
8c0faa1d DG |
34 | /* Channel stream list */ |
35 | struct ltt_kernel_stream_list { | |
36 | struct cds_list_head head; | |
37 | }; | |
38 | ||
39 | /* Channel list */ | |
40 | struct ltt_kernel_channel_list { | |
41 | struct cds_list_head head; | |
42 | }; | |
43 | ||
20fe2104 DG |
44 | /* Kernel event */ |
45 | struct ltt_kernel_event { | |
20fe2104 | 46 | int fd; |
e953ef25 | 47 | int enabled; |
d65106b1 | 48 | struct lttng_kernel_context *ctx; |
f34daff7 | 49 | struct lttng_kernel_event *event; |
20fe2104 DG |
50 | struct cds_list_head list; |
51 | }; | |
52 | ||
53 | /* Kernel channel */ | |
54 | struct ltt_kernel_channel { | |
55 | int fd; | |
d36b8583 | 56 | int enabled; |
8c0faa1d DG |
57 | char *pathname; |
58 | unsigned int stream_count; | |
cbbbb275 | 59 | unsigned int event_count; |
d65106b1 | 60 | struct lttng_kernel_context *ctx; |
f3ed775e | 61 | struct lttng_channel *channel; |
20fe2104 | 62 | struct ltt_kernel_event_list events_list; |
8c0faa1d DG |
63 | struct ltt_kernel_stream_list stream_list; |
64 | struct cds_list_head list; | |
20fe2104 DG |
65 | }; |
66 | ||
aaf26714 DG |
67 | /* Metadata */ |
68 | struct ltt_kernel_metadata { | |
69 | int fd; | |
8c0faa1d | 70 | char *pathname; |
f3ed775e | 71 | struct lttng_channel *conf; |
aaf26714 DG |
72 | }; |
73 | ||
8c0faa1d DG |
74 | /* Channel stream */ |
75 | struct ltt_kernel_stream { | |
76 | int fd; | |
77 | char *pathname; | |
78 | int state; | |
79 | struct cds_list_head list; | |
80 | }; | |
81 | ||
20fe2104 DG |
82 | /* Kernel session */ |
83 | struct ltt_kernel_session { | |
84 | int fd; | |
8c0faa1d | 85 | int metadata_stream_fd; |
f3ed775e | 86 | int kconsumer_fds_sent; |
8c0faa1d DG |
87 | unsigned int channel_count; |
88 | unsigned int stream_count_global; | |
aaf26714 | 89 | struct ltt_kernel_metadata *metadata; |
8c0faa1d | 90 | struct ltt_kernel_channel_list channel_list; |
fda89c9b DG |
91 | }; |
92 | ||
93 | /* UST trace representation */ | |
94 | struct ltt_ust_trace { | |
95 | struct cds_list_head list; | |
1657e9bb | 96 | char name[NAME_MAX]; |
fda89c9b DG |
97 | int shmid; |
98 | pid_t pid; | |
99 | struct cds_list_head markers; | |
100 | }; | |
101 | ||
102 | struct ltt_ust_marker { | |
103 | struct cds_list_head list; | |
104 | char *name; | |
105 | char *channel; | |
106 | }; | |
107 | ||
19e70852 DG |
108 | /* |
109 | * Get functions. | |
110 | */ | |
111 | struct ltt_kernel_event *get_kernel_event_by_name( | |
112 | char *name, struct ltt_kernel_channel *channel); | |
113 | struct ltt_kernel_channel *get_kernel_channel_by_name( | |
114 | char *name, struct ltt_kernel_session *session); | |
115 | ||
54012638 | 116 | /* |
c363b55d | 117 | * Create functions malloc() the data structure. |
54012638 | 118 | */ |
54012638 | 119 | struct ltt_kernel_session *trace_create_kernel_session(void); |
b082db07 | 120 | struct ltt_kernel_channel *trace_create_kernel_channel(struct lttng_channel *chan, char *path); |
f3ed775e | 121 | struct ltt_kernel_event *trace_create_kernel_event(struct lttng_event *ev); |
58a97671 | 122 | struct ltt_kernel_metadata *trace_create_kernel_metadata(char *path); |
54012638 DG |
123 | struct ltt_kernel_stream *trace_create_kernel_stream(void); |
124 | ||
c363b55d DG |
125 | /* |
126 | * Destroy functions free() the data structure and remove from linked list if | |
127 | * it's applies. | |
128 | */ | |
129 | void trace_destroy_kernel_session(struct ltt_kernel_session *session); | |
130 | void trace_destroy_kernel_metadata(struct ltt_kernel_metadata *metadata); | |
131 | void trace_destroy_kernel_channel(struct ltt_kernel_channel *channel); | |
132 | void trace_destroy_kernel_event(struct ltt_kernel_event *event); | |
133 | void trace_destroy_kernel_stream(struct ltt_kernel_stream *stream); | |
134 | ||
fda89c9b | 135 | #endif /* _LTT_TRACE_H */ |