2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2 only,
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 #ifndef _LTT_TRACE_KERNEL_H
19 #define _LTT_TRACE_KERNEL_H
22 #include <urcu/list.h>
24 #include <lttng/lttng.h>
25 #include <common/lttng-kernel.h>
27 /* Kernel event list */
28 struct ltt_kernel_event_list
{
29 struct cds_list_head head
;
32 /* Channel stream list */
33 struct ltt_kernel_stream_list
{
34 struct cds_list_head head
;
38 struct ltt_kernel_channel_list
{
39 struct cds_list_head head
;
43 struct ltt_kernel_event
{
47 * TODO: need internal representation to support more than a
50 struct lttng_kernel_context
*ctx
;
51 struct lttng_kernel_event
*event
;
52 struct cds_list_head list
;
56 struct ltt_kernel_channel
{
60 unsigned int stream_count
;
61 unsigned int event_count
;
63 * TODO: need internal representation to support more than a
66 struct lttng_kernel_context
*ctx
;
67 struct lttng_channel
*channel
;
68 struct ltt_kernel_event_list events_list
;
69 struct ltt_kernel_stream_list stream_list
;
70 struct cds_list_head list
;
74 struct ltt_kernel_metadata
{
77 struct lttng_channel
*conf
;
81 struct ltt_kernel_stream
{
85 struct cds_list_head list
;
89 struct ltt_kernel_session
{
91 int metadata_stream_fd
;
92 int consumer_fds_sent
;
94 unsigned int channel_count
;
95 unsigned int stream_count_global
;
97 struct ltt_kernel_metadata
*metadata
;
98 struct ltt_kernel_channel_list channel_list
;
99 /* UID/GID of the user owning the session */
105 * Lookup functions. NULL is returned if not found.
107 struct ltt_kernel_event
*trace_kernel_get_event_by_name(
108 char *name
, struct ltt_kernel_channel
*channel
);
109 struct ltt_kernel_channel
*trace_kernel_get_channel_by_name(
110 char *name
, struct ltt_kernel_session
*session
);
113 * Create functions malloc() the data structure.
115 struct ltt_kernel_session
*trace_kernel_create_session(char *path
);
116 struct ltt_kernel_channel
*trace_kernel_create_channel(struct lttng_channel
*chan
, char *path
);
117 struct ltt_kernel_event
*trace_kernel_create_event(struct lttng_event
*ev
);
118 struct ltt_kernel_metadata
*trace_kernel_create_metadata(char *path
);
119 struct ltt_kernel_stream
*trace_kernel_create_stream(void);
122 * Destroy functions free() the data structure and remove from linked list if
125 void trace_kernel_destroy_session(struct ltt_kernel_session
*session
);
126 void trace_kernel_destroy_metadata(struct ltt_kernel_metadata
*metadata
);
127 void trace_kernel_destroy_channel(struct ltt_kernel_channel
*channel
);
128 void trace_kernel_destroy_event(struct ltt_kernel_event
*event
);
129 void trace_kernel_destroy_stream(struct ltt_kernel_stream
*stream
);
131 #endif /* _LTT_TRACE_KERNEL_H */