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_UST_H
20 #define _LTT_TRACE_UST_H
24 #include <urcu/list.h>
25 #include <lttng/lttng.h>
28 * FIXME: temporary workaround: we use a lttng-tools local version of
29 * lttng-ust-abi.h if UST is not found. Eventually, we should use our
30 * own internal structures within lttng-tools instead of relying on the
33 #ifdef CONFIG_CONFIG_LTTNG_TOOLS_HAVE_UST
34 #include <ust/lttng-ust-abi.h>
36 #include "lttng-ust-abi.h"
42 struct ltt_ust_session_list
{
44 struct cds_list_head head
;
48 struct ltt_ust_event_list
{
50 struct cds_list_head head
;
54 struct ltt_ust_stream_list
{
56 struct cds_list_head head
;
59 /* UST Channel list */
60 struct ltt_ust_channel_list
{
62 struct cds_list_head head
;
66 struct ltt_ust_event
{
70 * TODO: need internal representation to support more than a
73 struct lttng_ust_context ctx
;
74 struct lttng_ust_event attr
;
75 struct cds_list_head list
;
76 struct object_data
*obj
;
80 struct ltt_ust_stream
{
81 struct object_data
*obj
;
82 struct cds_list_head list
;
87 struct ltt_ust_channel
{
90 char name
[LTTNG_UST_SYM_NAME_LEN
];
91 char trace_path
[PATH_MAX
]; /* Trace file path name */
93 * TODO: need internal representation to support more than a
96 struct lttng_ust_context ctx
;
97 struct lttng_ust_channel attr
;
98 struct ltt_ust_event_list events
;
99 struct cds_list_head list
;
100 struct object_data
*obj
;
101 unsigned int stream_count
;
102 struct ltt_ust_stream_list stream_list
;
106 struct ltt_ust_metadata
{
108 struct object_data
*obj
;
109 char *pathname
; /* Trace file path name */
110 struct lttng_ust_channel attr
;
111 struct object_data
*stream_obj
;
115 struct ltt_ust_session
{
116 int sock
; /* socket to send cmds to app */
119 int consumer_fds_sent
;
122 struct lttng_domain domain
;
123 struct ltt_ust_metadata
*metadata
;
124 struct ltt_ust_channel_list channels
;
125 struct cds_list_head list
;
126 struct object_data
*obj
;
129 #ifdef CONFIG_LTTNG_TOOLS_HAVE_UST
132 * Lookup functions. NULL is returned if not found.
134 struct ltt_ust_event
*trace_ust_get_event_by_name(
135 char *name
, struct ltt_ust_channel
*channel
);
136 struct ltt_ust_channel
*trace_ust_get_channel_by_name(
137 char *name
, struct ltt_ust_session
*session
);
138 struct ltt_ust_session
*trace_ust_get_session_by_pid(
139 struct ltt_ust_session_list
*session_list
, pid_t pid
);
142 * Create functions malloc() the data structure.
144 struct ltt_ust_session
*trace_ust_create_session(char *path
, pid_t pid
,
145 struct lttng_domain
*domain
);
146 struct ltt_ust_channel
*trace_ust_create_channel(struct lttng_channel
*attr
,
148 struct ltt_ust_event
*trace_ust_create_event(struct lttng_event
*ev
);
149 struct ltt_ust_metadata
*trace_ust_create_metadata(char *path
);
152 * Destroy functions free() the data structure and remove from linked list if
155 void trace_ust_destroy_session(struct ltt_ust_session
*session
);
156 void trace_ust_destroy_metadata(struct ltt_ust_metadata
*metadata
);
157 void trace_ust_destroy_channel(struct ltt_ust_channel
*channel
);
158 void trace_ust_destroy_event(struct ltt_ust_event
*event
);
163 struct ltt_ust_event
*trace_ust_get_event_by_name(
164 char *name
, struct ltt_ust_channel
*channel
)
169 struct ltt_ust_channel
*trace_ust_get_channel_by_name(
170 char *name
, struct ltt_ust_session
*session
)
175 struct ltt_ust_session
*trace_ust_get_session_by_pid(
176 struct ltt_ust_session_list
*session_list
, pid_t pid
)
182 struct ltt_ust_session
*trace_ust_create_session(char *path
, pid_t pid
,
183 struct lttng_domain
*domain
)
188 struct ltt_ust_channel
*trace_ust_create_channel(struct lttng_channel
*attr
,
194 struct ltt_ust_event
*trace_ust_create_event(struct lttng_event
*ev
)
199 struct ltt_ust_metadata
*trace_ust_create_metadata(char *path
)
205 void trace_ust_destroy_session(struct ltt_ust_session
*session
)
209 void trace_ust_destroy_metadata(struct ltt_ust_metadata
*metadata
)
213 void trace_ust_destroy_channel(struct ltt_ust_channel
*channel
)
217 void trace_ust_destroy_event(struct ltt_ust_event
*event
)
223 #endif /* _LTT_TRACE_UST_H */