1 #ifndef BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H
2 #define BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H
5 * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #include "common/babeltrace.h"
27 #include <babeltrace2/babeltrace.h>
28 #include "ctfser/ctfser.h"
33 #include "fs-sink-ctf-meta.h"
37 struct fs_sink_trace
{
38 struct fs_sink_comp
*fs_sink
;
41 struct fs_sink_ctf_trace_class
*tc
;
44 * Weak reference: this object does not own it, and `tc` above
45 * does not own its trace IR trace class either. Instead, we add
46 * a "trace destruction" listener (in create_trace()) so that
47 * this object gets destroyed when the trace object is
50 * Otherwise (with a strong reference), we would keep this trace
51 * object alive until the upstream message iterator ends. This
52 * could "leak" resources (memory, file descriptors) associated
53 * to traces and streams which otherwise would not exist.
55 const bt_trace
*ir_trace
;
57 uint64_t ir_trace_destruction_listener_id
;
59 /* Trace's directory */
62 /* `metadata` file path */
63 GString
*metadata_path
;
66 * Hash table of `const bt_stream *` (weak) to
67 * `struct fs_sink_stream *` (owned by hash table).
73 struct fs_sink_trace
*fs_sink_trace_create(struct fs_sink_comp
*fs_sink
,
74 const bt_trace
*ir_trace
);
77 void fs_sink_trace_destroy(struct fs_sink_trace
*trace
);
79 #endif /* BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H */