Add UST trace data structure and functions
[lttng-tools.git] / ltt-sessiond / trace-ust.h
... / ...
CommitLineData
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/* UST event list */
29struct ltt_ust_event_list {
30 unsigned int count;
31 struct cds_list_head head;
32};
33
34/* UST Channel list */
35struct ltt_ust_channel_list {
36 unsigned int count;
37 struct cds_list_head head;
38};
39
40/* UST event */
41struct ltt_ust_event {
42 int handle;
43 int enabled;
44 struct lttng_ust_context *ctx;
45 struct lttng_ust_event *event;
46 struct cds_list_head list;
47};
48
49/* UST channel */
50struct ltt_ust_channel {
51 int handle;
52 int enabled;
53 char *name;
54 char *trace_path; /* Trace file path name */
55 struct lttng_ust_context *ctx;
56 struct lttng_ust_channel *attr;
57 struct ltt_ust_event_list events;
58 struct cds_list_head list;
59};
60
61/* UST Metadata */
62struct ltt_ust_metadata {
63 int handle;
64 char *trace_path; /* Trace file path name */
65 struct lttng_ust_channel *attr;
66};
67
68/* UST session */
69struct ltt_ust_session {
70 int handle;
71 int enabled;
72 int uconsumer_fds_sent;
73 char *path;
74 struct ltt_ust_metadata *metadata;
75 struct ltt_ust_channel_list channels;
76};
77
78/*
79 * Lookup functions. NULL is returned if not found.
80 */
81struct ltt_ust_event *trace_ust_get_event_by_name(
82 char *name, struct ltt_ust_channel *channel);
83struct ltt_ust_channel *trace_ust_get_channel_by_name(
84 char *name, struct ltt_ust_session *session);
85
86/*
87 * Create functions malloc() the data structure.
88 */
89struct ltt_ust_session *trace_ust_create_session(void);
90struct ltt_ust_channel *trace_ust_create_channel(char *name, char *path,
91 struct lttng_ust_channel *attr);
92struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev);
93struct ltt_ust_metadata *trace_ust_create_metadata(char *path);
94
95/*
96 * Destroy functions free() the data structure and remove from linked list if
97 * it's applies.
98 */
99void trace_ust_destroy_session(struct ltt_ust_session *session);
100void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata);
101void trace_ust_destroy_channel(struct ltt_ust_channel *channel);
102void trace_ust_destroy_event(struct ltt_ust_event *event);
103
104#endif /* _LTT_TRACE_UST_H */
This page took 0.022777 seconds and 4 git commands to generate.