Commit | Line | Data |
---|---|---|
7591bab1 MD |
1 | #ifndef _CTF_TRACE_H |
2 | #define _CTF_TRACE_H | |
3 | ||
d3e2ba59 JD |
4 | /* |
5 | * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com> | |
6 | * David Goulet <dgoulet@efficios.com> | |
7591bab1 | 7 | * 2015 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
d3e2ba59 JD |
8 | * |
9 | * This program is free software; you can redistribute it and/or modify it | |
10 | * under the terms of the GNU General Public License, version 2 only, as | |
11 | * published by the Free Software Foundation. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
16 | * more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License along with | |
19 | * this program; if not, write to the Free Software Foundation, Inc., 51 | |
20 | * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
21 | */ | |
22 | ||
d3e2ba59 | 23 | #include <inttypes.h> |
7591bab1 | 24 | #include <urcu/ref.h> |
d3e2ba59 JD |
25 | |
26 | #include <common/hashtable/hashtable.h> | |
27 | ||
2a174661 | 28 | #include "session.h" |
58eb9381 | 29 | #include "stream.h" |
7591bab1 | 30 | #include "viewer-stream.h" |
d3e2ba59 JD |
31 | |
32 | struct ctf_trace { | |
7591bab1 MD |
33 | struct urcu_ref ref; /* Every stream has a ref on the trace. */ |
34 | struct relay_session *session; /* Back ref to trace session */ | |
35 | ||
36 | /* | |
37 | * The ctf_trace lock nests inside the session lock. | |
38 | */ | |
39 | pthread_mutex_t lock; | |
d3e2ba59 | 40 | uint64_t id; |
7591bab1 | 41 | struct relay_viewer_stream *viewer_metadata_stream; /* RCU protected */ |
2a174661 | 42 | |
7591bab1 MD |
43 | /* |
44 | * Relay streams associated with this ctf trace. | |
45 | * Updates are protected by the stream_list lock. | |
46 | * Traversals are protected by RCU. | |
47 | */ | |
2a174661 | 48 | struct cds_list_head stream_list; |
7591bab1 MD |
49 | pthread_mutex_t stream_list_lock; |
50 | ||
51 | /* | |
52 | * Node within session trace hash table. Node is indexed by | |
53 | * stream path name. | |
54 | */ | |
55 | struct lttng_ht_node_str node; | |
56 | struct rcu_head rcu_node; /* For call_rcu teardown. */ | |
d3e2ba59 JD |
57 | }; |
58 | ||
7591bab1 MD |
59 | struct ctf_trace *ctf_trace_get_by_path_or_create(struct relay_session *session, |
60 | char *path_name); | |
61 | bool ctf_trace_get(struct ctf_trace *trace); | |
62 | void ctf_trace_put(struct ctf_trace *trace); | |
2a174661 | 63 | |
7591bab1 | 64 | int ctf_trace_close(struct ctf_trace *trace); |
2a174661 | 65 | |
7591bab1 | 66 | struct relay_viewer_stream *ctf_trace_get_viewer_metadata_stream(struct ctf_trace *trace); |
d3e2ba59 JD |
67 | |
68 | #endif /* _CTF_TRACE_H */ |