2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
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; only version 2
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.
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.
19 #ifndef _LTT_TRACE_KERNEL_H
20 #define _LTT_TRACE_KERNEL_H
23 #include <urcu/list.h>
25 #include <lttng/lttng.h>
26 #include <lttng-kernel.h>
28 /* Kernel event list */
29 struct ltt_kernel_event_list
{
30 struct cds_list_head head
;
33 /* Channel stream list */
34 struct ltt_kernel_stream_list
{
35 struct cds_list_head head
;
39 struct ltt_kernel_channel_list
{
40 struct cds_list_head head
;
44 struct ltt_kernel_event
{
47 struct lttng_kernel_context
*ctx
;
48 struct lttng_kernel_event
*event
;
49 struct cds_list_head list
;
53 struct ltt_kernel_channel
{
57 unsigned int stream_count
;
58 unsigned int event_count
;
59 struct lttng_kernel_context
*ctx
;
60 struct lttng_channel
*channel
;
61 struct ltt_kernel_event_list events_list
;
62 struct ltt_kernel_stream_list stream_list
;
63 struct cds_list_head list
;
67 struct ltt_kernel_metadata
{
70 struct lttng_channel
*conf
;
74 struct ltt_kernel_stream
{
78 struct cds_list_head list
;
82 struct ltt_kernel_session
{
84 int metadata_stream_fd
;
85 int kconsumer_fds_sent
;
87 unsigned int channel_count
;
88 unsigned int stream_count_global
;
90 struct ltt_kernel_metadata
*metadata
;
91 struct ltt_kernel_channel_list channel_list
;
95 * Lookup functions. NULL is returned if not found.
97 struct ltt_kernel_event
*trace_kernel_get_event_by_name(
98 char *name
, struct ltt_kernel_channel
*channel
);
99 struct ltt_kernel_channel
*trace_kernel_get_channel_by_name(
100 char *name
, struct ltt_kernel_session
*session
);
103 * Create functions malloc() the data structure.
105 struct ltt_kernel_session
*trace_kernel_create_session(char *path
);
106 struct ltt_kernel_channel
*trace_kernel_create_channel(struct lttng_channel
*chan
, char *path
);
107 struct ltt_kernel_event
*trace_kernel_create_event(struct lttng_event
*ev
);
108 struct ltt_kernel_metadata
*trace_kernel_create_metadata(char *path
);
109 struct ltt_kernel_stream
*trace_kernel_create_stream(void);
112 * Destroy functions free() the data structure and remove from linked list if
115 void trace_kernel_destroy_session(struct ltt_kernel_session
*session
);
116 void trace_kernel_destroy_metadata(struct ltt_kernel_metadata
*metadata
);
117 void trace_kernel_destroy_channel(struct ltt_kernel_channel
*channel
);
118 void trace_kernel_destroy_event(struct ltt_kernel_event
*event
);
119 void trace_kernel_destroy_stream(struct ltt_kernel_stream
*stream
);
121 #endif /* _LTT_TRACE_KERNEL_H */