Add missing file to extra dist
[lttng-tools.git] / ltt-sessiond / trace-ust.h
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; only version 2
7 * of the License.
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_UST_H
20 #define _LTT_TRACE_UST_H
21
22 #include <limits.h>
23 #include <urcu/list.h>
24
25 #include <lttng/lttng.h>
26 #include <lttng-ust.h>
27
28 #include "traceable-app.h"
29
30 /*
31 * UST session list.
32 */
33 struct ltt_ust_session_list {
34 unsigned int count;
35 struct cds_list_head head;
36 };
37
38 /* UST event list */
39 struct ltt_ust_event_list {
40 unsigned int count;
41 struct cds_list_head head;
42 };
43
44 /* UST Channel list */
45 struct ltt_ust_channel_list {
46 unsigned int count;
47 struct cds_list_head head;
48 };
49
50 /* UST event */
51 struct ltt_ust_event {
52 int handle;
53 int enabled;
54 struct lttng_ust_context *ctx;
55 struct lttng_ust_event *event;
56 struct cds_list_head list;
57 };
58
59 /* UST channel */
60 struct ltt_ust_channel {
61 int handle;
62 int enabled;
63 char *name;
64 char *trace_path; /* Trace file path name */
65 struct lttng_ust_context *ctx;
66 struct lttng_ust_channel *attr;
67 struct ltt_ust_event_list events;
68 struct cds_list_head list;
69 };
70
71 /* UST Metadata */
72 struct ltt_ust_metadata {
73 int handle;
74 char *trace_path; /* Trace file path name */
75 struct lttng_ust_channel *attr;
76 };
77
78 /* UST session */
79 struct ltt_ust_session {
80 int handle;
81 int enabled;
82 int uconsumer_fds_sent;
83 char *path;
84 struct ltt_traceable_app *app;
85 struct ltt_ust_metadata *metadata;
86 struct ltt_ust_channel_list channels;
87 struct cds_list_head list;
88 };
89
90 /*
91 * Lookup functions. NULL is returned if not found.
92 */
93 struct ltt_ust_event *trace_ust_get_event_by_name(
94 char *name, struct ltt_ust_channel *channel);
95 struct ltt_ust_channel *trace_ust_get_channel_by_name(
96 char *name, struct ltt_ust_session *session);
97 struct ltt_ust_session *trace_ust_get_session_by_pid(pid_t pid,
98 struct ltt_ust_session_list *session_list);
99
100 /*
101 * Create functions malloc() the data structure.
102 */
103 struct ltt_ust_session *trace_ust_create_session(char *path, pid_t pid);
104 struct ltt_ust_channel *trace_ust_create_channel(char *name, char *path,
105 struct lttng_ust_channel *attr);
106 struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev);
107 struct ltt_ust_metadata *trace_ust_create_metadata(char *path);
108
109 /*
110 * Destroy functions free() the data structure and remove from linked list if
111 * it's applies.
112 */
113 void trace_ust_destroy_session(struct ltt_ust_session *session);
114 void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata);
115 void trace_ust_destroy_channel(struct ltt_ust_channel *channel);
116 void trace_ust_destroy_event(struct ltt_ust_event *event);
117
118 #endif /* _LTT_TRACE_UST_H */
This page took 0.03229 seconds and 4 git commands to generate.