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 | |
6 | * as published by the Free Software Foundation; either version 2 | |
7 | * of the License, or (at your option) any later version. | |
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> | |
20fe2104 | 24 | #include "lttng-kernel.h" |
d4a2a84a | 25 | |
54012638 DG |
26 | /* Default kernel channel attributes */ |
27 | #define DEFAULT_KERNEL_OVERWRITE 0 | |
28 | #define DEFAULT_KERNEL_SUBBUF_SIZE 4096 /* bytes */ | |
29 | #define DEFAULT_KERNEL_SUBBUF_NUM 8 /* Must always be a power of 2 */ | |
30 | #define DEFAULT_KERNEL_SWITCH_TIMER 0 /* usec */ | |
31 | #define DEFAULT_KERNEL_READ_TIMER 200 /* usec */ | |
32 | ||
20fe2104 DG |
33 | /* Kernel event list */ |
34 | struct ltt_kernel_event_list { | |
35 | struct cds_list_head head; | |
36 | }; | |
37 | ||
8c0faa1d DG |
38 | /* Channel stream list */ |
39 | struct ltt_kernel_stream_list { | |
40 | struct cds_list_head head; | |
41 | }; | |
42 | ||
43 | /* Channel list */ | |
44 | struct ltt_kernel_channel_list { | |
45 | struct cds_list_head head; | |
46 | }; | |
47 | ||
20fe2104 DG |
48 | /* Kernel event */ |
49 | struct ltt_kernel_event { | |
20fe2104 | 50 | int fd; |
f34daff7 | 51 | struct lttng_kernel_event *event; |
20fe2104 DG |
52 | struct cds_list_head list; |
53 | }; | |
54 | ||
55 | /* Kernel channel */ | |
56 | struct ltt_kernel_channel { | |
57 | int fd; | |
8c0faa1d DG |
58 | char *pathname; |
59 | unsigned int stream_count; | |
9cb98350 | 60 | struct lttng_kernel_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; |
aaf26714 DG |
70 | struct lttng_kernel_channel *conf; |
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 DG |
84 | int metadata_stream_fd; |
85 | unsigned int channel_count; | |
86 | unsigned int stream_count_global; | |
aaf26714 | 87 | struct ltt_kernel_metadata *metadata; |
8c0faa1d | 88 | struct ltt_kernel_channel_list channel_list; |
fda89c9b DG |
89 | }; |
90 | ||
91 | /* UST trace representation */ | |
92 | struct ltt_ust_trace { | |
93 | struct cds_list_head list; | |
1657e9bb | 94 | char name[NAME_MAX]; |
fda89c9b DG |
95 | int shmid; |
96 | pid_t pid; | |
97 | struct cds_list_head markers; | |
98 | }; | |
99 | ||
100 | struct ltt_ust_marker { | |
101 | struct cds_list_head list; | |
102 | char *name; | |
103 | char *channel; | |
104 | }; | |
105 | ||
54012638 | 106 | /* |
c363b55d | 107 | * Create functions malloc() the data structure. |
54012638 | 108 | */ |
54012638 | 109 | struct ltt_kernel_session *trace_create_kernel_session(void); |
54012638 | 110 | struct ltt_kernel_channel *trace_create_kernel_channel(void); |
54012638 DG |
111 | struct ltt_kernel_event *trace_create_kernel_event(char *name, |
112 | enum lttng_kernel_instrumentation type); | |
54012638 | 113 | struct ltt_kernel_metadata *trace_create_kernel_metadata(void); |
54012638 DG |
114 | struct ltt_kernel_stream *trace_create_kernel_stream(void); |
115 | ||
c363b55d DG |
116 | /* |
117 | * Destroy functions free() the data structure and remove from linked list if | |
118 | * it's applies. | |
119 | */ | |
120 | void trace_destroy_kernel_session(struct ltt_kernel_session *session); | |
121 | void trace_destroy_kernel_metadata(struct ltt_kernel_metadata *metadata); | |
122 | void trace_destroy_kernel_channel(struct ltt_kernel_channel *channel); | |
123 | void trace_destroy_kernel_event(struct ltt_kernel_event *event); | |
124 | void trace_destroy_kernel_stream(struct ltt_kernel_stream *stream); | |
125 | ||
fda89c9b | 126 | #endif /* _LTT_TRACE_H */ |