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
21 #include <urcu/list.h>
23 #include <lttng/lttng.h>
24 #include <common/lttng-kernel.h>
26 /* Kernel event list */
27 struct ltt_kernel_event_list
{
28 struct cds_list_head head
;
31 /* Channel stream list */
32 struct ltt_kernel_stream_list
{
33 struct cds_list_head head
;
37 struct ltt_kernel_channel_list
{
38 struct cds_list_head head
;
42 struct ltt_kernel_event
{
46 * TODO: need internal representation to support more than a
49 struct lttng_kernel_context
*ctx
;
50 struct lttng_kernel_event
*event
;
51 struct cds_list_head list
;
55 struct ltt_kernel_channel
{
59 unsigned int stream_count
;
60 unsigned int event_count
;
62 * TODO: need internal representation to support more than a
65 struct lttng_kernel_context
*ctx
;
66 struct lttng_channel
*channel
;
67 struct ltt_kernel_event_list events_list
;
68 struct ltt_kernel_stream_list stream_list
;
69 struct cds_list_head list
;
73 struct ltt_kernel_metadata
{
76 struct lttng_channel
*conf
;
80 struct ltt_kernel_stream
{
84 struct cds_list_head list
;
88 struct ltt_kernel_session
{
90 int metadata_stream_fd
;
91 int consumer_fds_sent
;
93 unsigned int channel_count
;
94 unsigned int stream_count_global
;
96 struct ltt_kernel_metadata
*metadata
;
97 struct ltt_kernel_channel_list channel_list
;
98 /* UID/GID of the user owning the session */
104 * Lookup functions. NULL is returned if not found.
106 struct ltt_kernel_event
*trace_kernel_get_event_by_name(
107 char *name
, struct ltt_kernel_channel
*channel
);
108 struct ltt_kernel_channel
*trace_kernel_get_channel_by_name(
109 char *name
, struct ltt_kernel_session
*session
);
112 * Create functions malloc() the data structure.
114 struct ltt_kernel_session
*trace_kernel_create_session(char *path
);
115 struct ltt_kernel_channel
*trace_kernel_create_channel(struct lttng_channel
*chan
, char *path
);
116 struct ltt_kernel_event
*trace_kernel_create_event(struct lttng_event
*ev
);
117 struct ltt_kernel_metadata
*trace_kernel_create_metadata(char *path
);
118 struct ltt_kernel_stream
*trace_kernel_create_stream(void);
121 * Destroy functions free() the data structure and remove from linked list if
124 void trace_kernel_destroy_session(struct ltt_kernel_session
*session
);
125 void trace_kernel_destroy_metadata(struct ltt_kernel_metadata
*metadata
);
126 void trace_kernel_destroy_channel(struct ltt_kernel_channel
*channel
);
127 void trace_kernel_destroy_event(struct ltt_kernel_event
*event
);
128 void trace_kernel_destroy_stream(struct ltt_kernel_stream
*stream
);
130 #endif /* _LTT_TRACE_KERNEL_H */