/usr/include/babeltrace/ctf-writer/writer.h is in libbabeltrace-dev 1.2.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | #ifndef BABELTRACE_CTF_WRITER_WRITER_H
#define BABELTRACE_CTF_WRITER_WRITER_H
/*
* BabelTrace - CTF Writer: Writer
*
* Copyright 2013 EfficiOS Inc.
*
* Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* The Common Trace Format (CTF) Specification is available at
* http://www.efficios.com/ctf
*/
#ifdef __cplusplus
extern "C" {
#endif
struct bt_ctf_writer;
struct bt_ctf_stream;
struct bt_ctf_stream_class;
struct bt_ctf_clock;
enum bt_ctf_byte_order {
BT_CTF_BYTE_ORDER_NATIVE = 0,
BT_CTF_BYTE_ORDER_LITTLE_ENDIAN,
BT_CTF_BYTE_ORDER_BIG_ENDIAN,
BT_CTF_BYTE_ORDER_NETWORK,
};
/*
* bt_ctf_writer_create: create a writer instance.
*
* Allocate a new writer that will produce a trace in the given path.
* The creation of a writer sets its reference count to 1.
*
* @param path Path to the trace's containing folder (string is copied).
*
* Returns an allocated writer on success, NULL on error.
*/
extern struct bt_ctf_writer *bt_ctf_writer_create(const char *path);
/*
* bt_ctf_writer_create_stream: create a stream instance.
*
* Allocate a new stream instance and register it to the writer. The creation of
* a stream sets its reference count to 1.
*
* @param writer Writer instance.
* @param stream_class Stream class to instantiate.
*
* Returns an allocated writer on success, NULL on error.
*/
extern struct bt_ctf_stream *bt_ctf_writer_create_stream(
struct bt_ctf_writer *writer,
struct bt_ctf_stream_class *stream_class);
/*
* bt_ctf_writer_add_environment_field: add an environment field to the trace.
*
* Add an environment field to the trace. The name and value parameters are
* copied.
*
* @param writer Writer instance.
* @param name Name of the environment field (will be copied).
* @param value Value of the environment field (will be copied).
*
* Returns 0 on success, a negative value on error.
*/
extern int bt_ctf_writer_add_environment_field(struct bt_ctf_writer *writer,
const char *name,
const char *value);
/*
* bt_ctf_writer_add_clock: add a clock to the trace.
*
* Add a clock to the trace. Clocks assigned to stream classes must be
* registered to the writer.
*
* @param writer Writer instance.
* @param clock Clock to add to the trace.
*
* Returns 0 on success, a negative value on error.
*/
extern int bt_ctf_writer_add_clock(struct bt_ctf_writer *writer,
struct bt_ctf_clock *clock);
/*
* bt_ctf_writer_get_metadata_string: get meta-data string.
*
* Get the trace's TSDL meta-data. The caller assumes the ownership of the
* returned string.
*
* @param writer Writer instance.
*
* Returns the metadata string on success, NULL on error.
*/
extern char *bt_ctf_writer_get_metadata_string(struct bt_ctf_writer *writer);
/*
* bt_ctf_writer_flush_metadata: flush the trace's metadata to disk.
*
* Flush the trace's metadata to the metadata file. Note that the metadata will
* be flushed automatically when the Writer instance is released (last call to
* bt_ctf_writer_put).
*
* @param writer Writer instance.
*/
extern void bt_ctf_writer_flush_metadata(struct bt_ctf_writer *writer);
/*
* bt_ctf_writer_set_byte_order: set a field type's byte order.
*
* Set the trace's byte order. Defaults to BT_CTF_BYTE_ORDER_NATIVE,
* the host machine's endianness.
*
* @param writer Writer instance.
* @param byte_order Trace's byte order.
*
* Returns 0 on success, a negative value on error.
*/
extern int bt_ctf_writer_set_byte_order(struct bt_ctf_writer *writer,
enum bt_ctf_byte_order byte_order);
/*
* bt_ctf_writer_get and bt_ctf_writer_put: increment and decrement the
* writer's reference count.
*
* These functions ensure that the writer won't be destroyed while it
* is in use. The same number of get and put (plus one extra put to
* release the initial reference done at creation) have to be done to
* destroy a writer.
*
* When the writer's reference count is decremented to 0 by a
* bt_ctf_writer_put, the writer is freed.
*
* @param writer Writer instance.
*/
extern void bt_ctf_writer_get(struct bt_ctf_writer *writer);
extern void bt_ctf_writer_put(struct bt_ctf_writer *writer);
#ifdef __cplusplus
}
#endif
#endif /* BABELTRACE_CTF_WRITER_WRITER_H */
|