Commit | Line | Data |
---|---|---|
7591bab1 MD |
1 | #ifndef _CTF_TRACE_H |
2 | #define _CTF_TRACE_H | |
3 | ||
d3e2ba59 | 4 | /* |
ab5be9fa MJ |
5 | * Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com> |
6 | * Copyright (C) 2013 David Goulet <dgoulet@efficios.com> | |
7 | * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
d3e2ba59 | 8 | * |
ab5be9fa | 9 | * SPDX-License-Identifier: GPL-2.0-only |
d3e2ba59 | 10 | * |
d3e2ba59 JD |
11 | */ |
12 | ||
c9e313bc SM |
13 | #include "session.hpp" |
14 | #include "stream.hpp" | |
15 | #include "viewer-stream.hpp" | |
d3e2ba59 | 16 | |
28f23191 JG |
17 | #include <common/hashtable/hashtable.hpp> |
18 | ||
19 | #include <inttypes.h> | |
20 | #include <urcu/ref.h> | |
21 | ||
d3e2ba59 | 22 | struct ctf_trace { |
28f23191 JG |
23 | struct urcu_ref ref; /* Every stream has a ref on the trace. */ |
24 | struct relay_session *session; /* Back ref to trace session */ | |
7591bab1 | 25 | |
348a81dc JG |
26 | /* Trace sub-folder relative to the session output path. */ |
27 | char *path; | |
348a81dc | 28 | |
7591bab1 MD |
29 | /* |
30 | * The ctf_trace lock nests inside the session lock. | |
31 | */ | |
32 | pthread_mutex_t lock; | |
d3e2ba59 | 33 | uint64_t id; |
28f23191 | 34 | struct relay_viewer_stream *viewer_metadata_stream; /* RCU protected */ |
2a174661 | 35 | |
7591bab1 MD |
36 | /* |
37 | * Relay streams associated with this ctf trace. | |
38 | * Updates are protected by the stream_list lock. | |
39 | * Traversals are protected by RCU. | |
40 | */ | |
2a174661 | 41 | struct cds_list_head stream_list; |
7591bab1 MD |
42 | pthread_mutex_t stream_list_lock; |
43 | ||
44 | /* | |
45 | * Node within session trace hash table. Node is indexed by | |
46 | * stream path name. | |
47 | */ | |
48 | struct lttng_ht_node_str node; | |
28f23191 | 49 | struct rcu_head rcu_node; /* For call_rcu teardown. */ |
123ed7c2 FD |
50 | |
51 | /* | |
52 | * True if the metadata stream of this trace was sent the viewer in the | |
53 | * past. | |
54 | */ | |
55 | bool metadata_stream_sent_to_viewer; | |
d3e2ba59 JD |
56 | }; |
57 | ||
7591bab1 | 58 | struct ctf_trace *ctf_trace_get_by_path_or_create(struct relay_session *session, |
28f23191 | 59 | const char *subpath); |
7591bab1 MD |
60 | bool ctf_trace_get(struct ctf_trace *trace); |
61 | void ctf_trace_put(struct ctf_trace *trace); | |
2a174661 | 62 | |
7591bab1 | 63 | int ctf_trace_close(struct ctf_trace *trace); |
2a174661 | 64 | |
7591bab1 | 65 | struct relay_viewer_stream *ctf_trace_get_viewer_metadata_stream(struct ctf_trace *trace); |
d3e2ba59 JD |
66 | |
67 | #endif /* _CTF_TRACE_H */ |