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 | 25 | #include <lttng/lttng.h> |
1e307fab | 26 | #include <lttng-kernel.h> |
54012638 | 27 | |
20fe2104 DG |
28 | /* Kernel event list */ |
29 | struct ltt_kernel_event_list { | |
30 | struct cds_list_head head; | |
31 | }; | |
32 | ||
8c0faa1d DG |
33 | /* Channel stream list */ |
34 | struct ltt_kernel_stream_list { | |
35 | struct cds_list_head head; | |
36 | }; | |
37 | ||
38 | /* Channel list */ | |
39 | struct ltt_kernel_channel_list { | |
40 | struct cds_list_head head; | |
41 | }; | |
42 | ||
20fe2104 DG |
43 | /* Kernel event */ |
44 | struct ltt_kernel_event { | |
20fe2104 | 45 | int fd; |
e953ef25 | 46 | int enabled; |
d65106b1 | 47 | struct lttng_kernel_context *ctx; |
f34daff7 | 48 | struct lttng_kernel_event *event; |
20fe2104 DG |
49 | struct cds_list_head list; |
50 | }; | |
51 | ||
52 | /* Kernel channel */ | |
53 | struct ltt_kernel_channel { | |
54 | int fd; | |
d36b8583 | 55 | int enabled; |
8c0faa1d DG |
56 | char *pathname; |
57 | unsigned int stream_count; | |
cbbbb275 | 58 | unsigned int event_count; |
d65106b1 | 59 | struct lttng_kernel_context *ctx; |
f3ed775e | 60 | struct lttng_channel *channel; |
20fe2104 | 61 | struct ltt_kernel_event_list events_list; |
8c0faa1d DG |
62 | struct ltt_kernel_stream_list stream_list; |
63 | struct cds_list_head list; | |
20fe2104 DG |
64 | }; |
65 | ||
aaf26714 DG |
66 | /* Metadata */ |
67 | struct ltt_kernel_metadata { | |
68 | int fd; | |
8c0faa1d | 69 | char *pathname; |
f3ed775e | 70 | struct lttng_channel *conf; |
aaf26714 DG |
71 | }; |
72 | ||
8c0faa1d DG |
73 | /* Channel stream */ |
74 | struct ltt_kernel_stream { | |
75 | int fd; | |
76 | char *pathname; | |
77 | int state; | |
78 | struct cds_list_head list; | |
79 | }; | |
80 | ||
20fe2104 DG |
81 | /* Kernel session */ |
82 | struct ltt_kernel_session { | |
83 | int fd; | |
8c0faa1d | 84 | int metadata_stream_fd; |
f3ed775e | 85 | int kconsumer_fds_sent; |
d9800920 | 86 | int consumer_fd; |
8c0faa1d DG |
87 | unsigned int channel_count; |
88 | unsigned int stream_count_global; | |
63053e7c | 89 | char *trace_path; |
aaf26714 | 90 | struct ltt_kernel_metadata *metadata; |
8c0faa1d | 91 | struct ltt_kernel_channel_list channel_list; |
fda89c9b DG |
92 | }; |
93 | ||
94 | /* UST trace representation */ | |
95 | struct ltt_ust_trace { | |
96 | struct cds_list_head list; | |
1657e9bb | 97 | char name[NAME_MAX]; |
fda89c9b DG |
98 | int shmid; |
99 | pid_t pid; | |
100 | struct cds_list_head markers; | |
101 | }; | |
102 | ||
103 | struct ltt_ust_marker { | |
104 | struct cds_list_head list; | |
105 | char *name; | |
106 | char *channel; | |
107 | }; | |
108 | ||
19e70852 DG |
109 | struct ltt_kernel_event *get_kernel_event_by_name( |
110 | char *name, struct ltt_kernel_channel *channel); | |
111 | struct ltt_kernel_channel *get_kernel_channel_by_name( | |
112 | char *name, struct ltt_kernel_session *session); | |
113 | ||
54012638 | 114 | /* |
c363b55d | 115 | * Create functions malloc() the data structure. |
54012638 | 116 | */ |
54012638 | 117 | struct ltt_kernel_session *trace_create_kernel_session(void); |
b082db07 | 118 | struct ltt_kernel_channel *trace_create_kernel_channel(struct lttng_channel *chan, char *path); |
f3ed775e | 119 | struct ltt_kernel_event *trace_create_kernel_event(struct lttng_event *ev); |
58a97671 | 120 | struct ltt_kernel_metadata *trace_create_kernel_metadata(char *path); |
54012638 DG |
121 | struct ltt_kernel_stream *trace_create_kernel_stream(void); |
122 | ||
c363b55d DG |
123 | /* |
124 | * Destroy functions free() the data structure and remove from linked list if | |
125 | * it's applies. | |
126 | */ | |
127 | void trace_destroy_kernel_session(struct ltt_kernel_session *session); | |
128 | void trace_destroy_kernel_metadata(struct ltt_kernel_metadata *metadata); | |
129 | void trace_destroy_kernel_channel(struct ltt_kernel_channel *channel); | |
130 | void trace_destroy_kernel_event(struct ltt_kernel_event *event); | |
131 | void trace_destroy_kernel_stream(struct ltt_kernel_stream *stream); | |
132 | ||
fda89c9b | 133 | #endif /* _LTT_TRACE_H */ |