1 #ifndef BABELTRACE_CTF_IR_TRACE_H
2 #define BABELTRACE_CTF_IR_TRACE_H
5 * BabelTrace - CTF IR: Trace
7 * Copyright 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 * The Common Trace Format (CTF) Specification is available at
30 * http://www.efficios.com/ctf
33 #include <babeltrace/ctf-ir/field-types.h>
34 #include <babeltrace/ctf-ir/visitor.h>
35 #include <babeltrace/values.h>
36 #include <babeltrace/graph/notification.h>
44 @defgroup ctfirtraceclass CTF IR trace class
46 @brief CTF IR trace class.
49 #include <babeltrace/ctf-ir/trace.h>
52 A CTF IR <strong><em>trace class</em></strong> is a descriptor of
55 You can obtain a trace class in two different modes:
57 - <strong>Normal mode</strong>: use bt_ctf_trace_create() to create a
58 default, empty trace class.
59 - <strong>CTF writer mode</strong>: use bt_ctf_writer_get_trace() to
60 get the trace class created by a given CTF writer object.
62 A trace class has the following properties:
65 - A <strong>default byte order</strong>: all the
66 \link ctfirfieldtypes field types\endlink eventually part of the trace
67 class with a byte order set to #BT_CTF_BYTE_ORDER_NATIVE have this
69 - An \b environment, which is a custom key-value mapping. Keys are
70 strings and values can be strings or integers.
72 In the Babeltrace CTF IR system, a trace class contains zero or more
73 \link ctfirstreamclass stream classes\endlink, and a stream class
74 contains zero or more \link ctfireventclass event classes\endlink. You
75 can add an event class to a stream class with
76 bt_ctf_stream_class_add_event_class(). You can add a stream class to a
77 trace class with bt_ctf_trace_add_stream_class().
79 You can access the streams of a trace, that is, the streams which were
80 created from the trace's stream classes with bt_ctf_stream_create(),
81 with bt_ctf_trace_get_stream_by_index().
83 A trace class owns the <strong>trace packet header</strong>
84 \link ctfirfieldtypes field type\endlink, which represents the
85 \c trace.packet.header CTF scope. This field type describes the
86 trace packet header fields of the traces that this trace class
89 The trace packet header field type \em must be a structure field type as
90 of Babeltrace \btversion.
92 As per the CTF specification, the trace packet header field type \em
93 must contain a field named \c stream_id if the trace class contains more
94 than one stream class.
96 As a reminder, here's the structure of a CTF packet:
100 A trace class also contains zero or more
101 \link ctfirclockclass CTF IR clock classes\endlink.
104 Elaborate about clock classes irt clock values.
106 As with any Babeltrace object, CTF IR trace class objects have
107 <a href="https://en.wikipedia.org/wiki/Reference_counting">reference
108 counts</a>. See \ref refs to learn more about the reference counting
109 management of Babeltrace objects.
111 The following functions \em freeze their trace class parameter on
114 - bt_ctf_trace_add_stream_class()
115 - bt_ctf_writer_create_stream()
116 (\link ctfwriter CTF writer\endlink mode only)
118 You cannot modify a frozen trace class: it is considered immutable,
121 - Adding a stream class to it with
122 bt_ctf_trace_add_stream_class().
123 - Adding a CTF IR clock class to it with bt_ctf_trace_add_clock_class().
124 - \link refs Reference counting\endlink.
126 You can add a custom listener with bt_ctf_trace_add_listener() to get
127 notified if anything changes in a trace class, that is, if an event
128 class is added to one of its stream class, if a stream class is added,
129 or if a clock class is added.
136 @brief CTF IR trace class type and functions.
139 @addtogroup ctfirtraceclass
145 @brief A CTF IR trace class.
149 struct bt_ctf_stream
;
150 struct bt_ctf_stream_class
;
151 struct bt_ctf_clock_class
;
154 @name Creation function
159 @brief Creates a default CTF IR trace class.
161 On success, the trace packet header field type of the created trace
162 class has the following fields:
164 - <code>magic</code>: a 32-bit unsigned integer field type.
165 - <code>uuid</code>: an array field type of 16 8-bit unsigned integer
167 - <code>stream_id</code>: a 32-bit unsigned integer field type.
169 You can modify this default trace packet header field type after the
170 trace class is created with bt_ctf_trace_set_packet_header_type().
172 The created trace class has the following initial properties:
174 - <strong>Name</strong>: none. You can set a name
175 with bt_ctf_trace_set_name().
176 - <strong>Default byte order</strong>: #BT_CTF_BYTE_ORDER_NATIVE. You
177 can set a default byte order with bt_ctf_trace_set_native_byte_order().
179 Note that you \em must set the default byte order if any field type
180 contained in the created trace class, in its stream classes, or in
181 its event classes, has a byte order set to #BT_CTF_BYTE_ORDER_NATIVE.
182 - <strong>Environment</strong>: empty. You can add environment entries
183 with bt_ctf_trace_set_environment_field(),
184 bt_ctf_trace_set_environment_field_integer(), and
185 bt_ctf_trace_set_environment_field_string().
187 @returns Created trace class, or \c NULL on error.
189 @postsuccessrefcountret1
191 extern struct bt_ctf_trace
*bt_ctf_trace_create(void);
196 @name Properties functions
201 @brief Returns the name of the CTF IR trace class \p trace_class.
203 On success, \p trace_class remains the sole owner of the returned
204 string. The returned string is valid as long as \p trace_class exists
207 @param[in] trace_class Trace class of which to get the name.
208 @returns Name of trace class \p trace_class, or
209 \c NULL if \p trace_class is unnamed or
212 @prenotnull{trace_class}
213 @postrefcountsame{trace_class}
215 @sa bt_ctf_trace_set_name(): Sets the name of a given trace class.
217 extern const char *bt_ctf_trace_get_name(struct bt_ctf_trace
*trace_class
);
220 @brief Sets the name of the CTF IR trace class \p trace_class
223 @param[in] trace_class Trace class of which to set the name.
224 @param[in] name Name of the trace class (copied on success).
225 @returns 0 on success, or a negative value on error.
227 @prenotnull{trace_class}
230 @postrefcountsame{trace_class}
232 @sa bt_ctf_trace_get_name(): Returns the name of a given trace class.
234 extern int bt_ctf_trace_set_name(struct bt_ctf_trace
*trace_class
,
238 @brief Returns the default byte order of the CTF IR trace class
241 @param[in] trace_class Trace class of which to get the default byte
243 @returns Default byte order of trace class
244 \p trace_class, or #BT_CTF_BYTE_ORDER_UNKNOWN
247 @prenotnull{trace_class}
248 @postrefcountsame{trace_class}
250 @sa bt_ctf_trace_set_name(): Sets the name of a given trace class.
252 extern enum bt_ctf_byte_order
bt_ctf_trace_get_byte_order(
253 struct bt_ctf_trace
*trace_class
);
256 @brief Sets the default byte order of the CTF IR trace class
257 \p trace_class to \p native_byte_order.
259 \p native_byte_order \em must be one of:
261 - #BT_CTF_BYTE_ORDER_LITTLE_ENDIAN
262 - #BT_CTF_BYTE_ORDER_BIG_ENDIAN
263 - #BT_CTF_BYTE_ORDER_NETWORK
265 @param[in] trace_class Trace class of which to set the default byte
267 @param[in] native_byte_order Default byte order of the trace class.
268 @returns 0 on success, or a negative value on error.
270 @prenotnull{trace_class}
273 @pre \p native_byte_order is either #BT_CTF_BYTE_ORDER_LITTLE_ENDIAN,
274 #BT_CTF_BYTE_ORDER_BIG_ENDIAN, or
275 #BT_CTF_BYTE_ORDER_NETWORK.
276 @postrefcountsame{trace_class}
278 @sa bt_ctf_trace_get_name(): Returns the name of a given trace class.
280 extern int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace
*trace_class
,
281 enum bt_ctf_byte_order native_byte_order
);
284 @brief Returns the number of entries contained in the environment of
285 the CTF IR trace class \p trace_class.
287 @param[in] trace_class Trace class of which to get the number
288 of environment entries.
289 @returns Number of environment entries
290 contained in \p trace_class, or
291 a negative value on error.
293 @prenotnull{trace_class}
294 @postrefcountsame{trace_class}
296 extern int64_t bt_ctf_trace_get_environment_field_count(
297 struct bt_ctf_trace
*trace_class
);
300 @brief Returns the field name of the environment entry at index
301 \p index in the CTF IR trace class \p trace_class.
303 On success, the returned string is valid as long as this trace class
304 exists and is \em not modified. \p trace_class remains the sole owner of
307 @param[in] trace_class Trace class of which to get the name of the
308 environment entry at index \p index.
309 @param[in] index Index of environment entry to find.
310 @returns Name of the environment entry at index \p index
311 in \p trace_class, or \c NULL on error.
313 @prenotnull{trace_class}
314 @pre \p index is lesser than the number of environment entries in
315 \p trace_class (see bt_ctf_trace_get_environment_field_count()).
316 @postrefcountsame{trace_class}
318 @sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's
319 environment entry by index.
320 @sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace
321 class's environment entry by name.
322 @sa bt_ctf_trace_set_environment_field(): Sets the value of a trace
323 class's environment entry.
326 bt_ctf_trace_get_environment_field_name_by_index(
327 struct bt_ctf_trace
*trace_class
, uint64_t index
);
330 @brief Returns the value of the environment entry at index
331 \p index in the CTF IR trace class \p trace_class.
333 @param[in] trace_class Trace class of which to get the value of the
334 environment entry at index \p index.
335 @param[in] index Index of the environment entry to find.
336 @returns Value of the environment entry at index \p index
337 in \p trace_class, or \c NULL on error.
339 @prenotnull{trace_class}
340 @pre \p index is lesser than the number of environment entries in
341 \p trace_class (see bt_ctf_trace_get_environment_field_count()).
342 @postrefcountsame{trace_class}
343 @postsuccessrefcountretinc
345 @sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace
346 class's environment entry by name.
347 @sa bt_ctf_trace_set_environment_field(): Sets the value of a trace
348 class's environment entry.
350 extern struct bt_value
*
351 bt_ctf_trace_get_environment_field_value_by_index(struct bt_ctf_trace
*trace_class
,
355 @brief Returns the value of the environment entry named \p name
356 in the CTF IR trace class \p trace_class.
358 @param[in] trace_class Trace class of which to get the value of the
359 environment entry named \p name.
360 @param[in] name Name of the environment entry to find.
361 @returns Value of the environment entry named \p name
362 in \p trace_class, or \c NULL if there's no such
365 @prenotnull{trace_class}
367 @postrefcountsame{trace_class}
368 @postsuccessrefcountretinc
370 @sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's
371 environment entry by index.
372 @sa bt_ctf_trace_set_environment_field(): Sets the value of a trace
373 class's environment entry.
375 extern struct bt_value
*
376 bt_ctf_trace_get_environment_field_value_by_name(
377 struct bt_ctf_trace
*trace_class
, const char *name
);
380 @brief Sets the environment entry named \p name in the
381 CTF IR trace class \p trace_class to \p value.
383 If an environment entry named \p name exists in \p trace_class, its
384 value is first put, and then replaced by \p value.
386 @param[in] trace_class Trace class of which to set the environment
388 @param[in] name Name of the environment entry to set (copied
390 @param[in] value Value of the environment entry named \p name.
391 @returns 0 on success, or a negative value on error.
393 @prenotnull{trace_class}
398 \link bt_value_integer_create() integer value object\endlink
400 \link bt_value_string_create() string value object\endlink.
401 @postrefcountsame{trace_class}
402 @postsuccessrefcountinc{value}
404 @sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's
405 environment entry by index.
406 @sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace
407 class's environment entry by name.
409 extern int bt_ctf_trace_set_environment_field(
410 struct bt_ctf_trace
*trace_class
, const char *name
,
411 struct bt_value
*value
);
414 @brief Sets the environment entry named \p name in the
415 CTF IR trace class \p trace_class to \p value.
417 If an environment entry named \p name exists in \p trace_class, its
418 value is first put, and then replaced by a new
419 \link bt_value_integer_create() integer value object\endlink
422 @param[in] trace_class Trace class of which to set the environment
424 @param[in] name Name of the environment entry to set (copied
426 @param[in] value Value of the environment entry named \p name.
427 @returns 0 on success, or a negative value on error.
429 @prenotnull{trace_class}
432 @postrefcountsame{trace_class}
434 @sa bt_ctf_trace_set_environment_field(): Sets the value of a trace
435 class's environment entry.
437 extern int bt_ctf_trace_set_environment_field_integer(
438 struct bt_ctf_trace
*trace_class
, const char *name
,
442 @brief Sets the environment entry named \p name in the
443 CTF IR trace class \p trace_class to \p value.
445 If an environment entry named \p name exists in \p trace_class, its
446 value is first put, and then replaced by a new
447 \link bt_value_string_create() string value object\endlink
450 @param[in] trace_class Trace class of which to set the environment
452 @param[in] name Name of the environment entry to set (copied
454 @param[in] value Value of the environment entry named \p name
456 @returns 0 on success, or a negative value on error.
458 @prenotnull{trace_class}
462 @postrefcountsame{trace_class}
464 @sa bt_ctf_trace_set_environment_field(): Sets the value of a trace
465 class's environment entry.
467 extern int bt_ctf_trace_set_environment_field_string(
468 struct bt_ctf_trace
*trace_class
, const char *name
,
474 @name Contained field types functions
479 @brief Returns the packet header field type of the CTF IR trace class
482 @param[in] trace_class Trace class of which to get the packet
484 @returns Packet header field type of \p trace_class,
485 or \c NULL if \p trace_class has no packet header field
488 @prenotnull{trace_class}
489 @postrefcountsame{trace_class}
490 @post <strong>On success, if the return value is a field type</strong>, its
491 reference count is incremented.
493 @sa bt_ctf_trace_set_packet_header_type(): Sets the packet
494 header field type of a given trace class.
496 extern struct bt_ctf_field_type
*bt_ctf_trace_get_packet_header_type(
497 struct bt_ctf_trace
*trace_class
);
500 @brief Sets the packet header field type of the CTF IR trace class
501 \p trace_class to \p packet_header_type, or unsets the current packet
502 header field type from \p trace_class.
504 If \p packet_header_type is \c NULL, then this function unsets the current
505 packet header field type from \p trace_class, effectively making \p trace_class
506 a trace without a packet header field type.
508 As of Babeltrace \btversion, if \p packet_header_type is not \c NULL,
509 \p packet_header_type \em must be a CTF IR structure field type object.
511 @param[in] trace_class Trace class of which to set the packet
513 @param[in] packet_header_type Packet header field type, or \c NULL to unset
514 the current packet header field type.
515 @returns 0 on success, or a negative value on error.
517 @prenotnull{trace_class}
519 @pre <strong>\p packet_header_type, if not \c NULL</strong>, is a CTF IR
520 structure field type.
521 @postrefcountsame{trace_class}
522 @post <strong>On success, if \p packet_header_type is not \c NULL</strong>,
523 the reference count of \p packet_header_type is incremented.
525 @sa bt_ctf_trace_get_packet_header_type(): Returns the packet
526 header field type of a given trace class.
528 extern int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace
*trace_class
,
529 struct bt_ctf_field_type
*packet_header_type
);
534 @name Contained clock classes functions
539 @brief Returns the number of CTF IR clock classes contained in the
540 CTF IR trace class \p trace_class.
542 @param[in] trace_class Trace class of which to get the number
543 of contained clock classes.
544 @returns Number of contained clock classes
545 contained in \p trace_class, or a negative
548 @prenotnull{trace_class}
549 @postrefcountsame{trace_class}
551 extern int64_t bt_ctf_trace_get_clock_class_count(
552 struct bt_ctf_trace
*trace_class
);
555 @brief Returns the CTF IR clock class at index \p index in the CTF
556 IR trace class \p trace_class.
558 @param[in] trace_class Trace class of which to get the clock class
559 contained at index \p index.
560 @param[in] index Index of the clock class to find in
562 @returns Clock class at index \p index in \p trace_class,
565 @prenotnull{trace_class}
566 @pre \p index is lesser than the number of clock classes contained in
567 the trace class \p trace_class (see
568 bt_ctf_trace_get_clock_class_count()).
569 @postrefcountsame{trace_class}
570 @postsuccessrefcountretinc
572 @sa bt_ctf_trace_get_clock_class_by_name(): Finds a clock class by name
573 in a given trace class.
574 @sa bt_ctf_trace_add_clock_class(): Adds a clock class to a trace class.
576 extern struct bt_ctf_clock_class
*bt_ctf_trace_get_clock_class_by_index(
577 struct bt_ctf_trace
*trace_class
, uint64_t index
);
580 @brief Returns the CTF IR clock class named \c name found in the CTF
581 IR trace class \p trace_class.
583 @param[in] trace_class Trace class of which to get the clock class
585 @param[in] name Name of the clock class to find in \p trace_class.
586 @returns Clock class named \p name in \p trace_class,
589 @prenotnull{trace_class}
591 @postrefcountsame{trace_class}
592 @postsuccessrefcountretinc
594 @sa bt_ctf_trace_get_clock_class_by_index(): Returns the clock class contained
595 in a given trace class at a given index.
596 @sa bt_ctf_trace_add_clock_class(): Adds a clock class to a trace class.
598 extern struct bt_ctf_clock_class
*bt_ctf_trace_get_clock_class_by_name(
599 struct bt_ctf_trace
*trace_class
, const char *name
);
602 @brief Adds the CTF IR clock class \p clock_class to the CTF IR
603 trace class \p trace_class.
605 On success, \p trace_class contains \p clock_class.
607 You can call this function even if \p trace_class or \p clock_class
610 @param[in] trace_class Trace class to which to add \p clock_class.
611 @param[in] clock_class Clock class to add to \p trace_class.
612 @returns 0 on success, or a negative value on error.
614 @prenotnull{trace_class}
615 @prenotnull{clock_class}
616 @postrefcountsame{trace_class}
617 @postsuccessrefcountinc{clock_class}
618 @post <strong>On success, if \p trace_class is frozen</strong>,
619 \p clock_class is frozen.
621 @sa bt_ctf_trace_get_clock_class_by_index(): Returns the clock class contained
622 in a given trace class at a given index.
623 @sa bt_ctf_trace_get_clock_class_by_name(): Finds a clock class by name
624 in a given trace class.
626 extern int bt_ctf_trace_add_clock_class(struct bt_ctf_trace
*trace_class
,
627 struct bt_ctf_clock_class
*clock_class
);
632 @name Stream class children functions
637 @brief Returns the number of stream classes contained in the
638 CTF IR trace class \p trace_class.
640 @param[in] trace_class Trace class of which to get the number
641 of children stream classes.
642 @returns Number of children stream classes
643 contained in \p trace_class, or a negative
646 @prenotnull{trace_class}
647 @postrefcountsame{trace_class}
649 extern int64_t bt_ctf_trace_get_stream_class_count(
650 struct bt_ctf_trace
*trace_class
);
653 @brief Returns the stream class at index \p index in the CTF IR trace
654 class \p trace_class.
656 @param[in] trace_class Trace class of which to get the stream class.
657 @param[in] index Index of the stream class to find.
658 @returns Stream class at index \p index, or \c NULL
661 @prenotnull{trace_class}
662 @pre \p index is lesser than the number of stream classes contained in
663 the trace class \p trace_class (see
664 bt_ctf_trace_get_stream_class_count()).
665 @postrefcountsame{trace_class}
667 @sa bt_ctf_trace_get_stream_class_by_id(): Finds a stream class by ID.
668 @sa bt_ctf_trace_add_stream_class(): Adds a stream class to a trace class.
670 extern struct bt_ctf_stream_class
*bt_ctf_trace_get_stream_class_by_index(
671 struct bt_ctf_trace
*trace_class
, uint64_t index
);
674 @brief Returns the stream class with ID \c id found in the CTF IR
675 trace class \p trace_class.
677 @param[in] trace_class Trace class of which to get the stream class.
678 @param[in] id ID of the stream class to find.
679 @returns Stream class with ID \p id, or \c NULL
682 @prenotnull{trace_class}
683 @postrefcountsame{trace_class}
684 @postsuccessrefcountretinc
686 @sa bt_ctf_trace_get_stream_class_by_index(): Returns the stream class contained
687 in a given trace class at a given index.
688 @sa bt_ctf_trace_add_stream_class(): Adds a stream class to a trace class.
690 extern struct bt_ctf_stream_class
*bt_ctf_trace_get_stream_class_by_id(
691 struct bt_ctf_trace
*trace_class
, uint64_t id
);
694 @brief Adds the CTF IR stream class \p stream_class to the
695 CTF IR trace class \p trace_class.
697 On success, \p stream_class becomes the child of \p trace_class.
699 You can only add a given stream class to one trace class.
701 You can call this function even if \p trace_class is frozen.
703 This function tries to resolve the needed
704 \link ctfirfieldtypes CTF IR field type\endlink of the dynamic field
705 types that are found anywhere in the root field types of
706 \p stream_class and of all its currently contained
707 \link ctfireventclass CTF IR event classes\endlink. If any automatic
708 resolving fails, then this function fails.
710 @param[in] trace_class Trace class to which to add \p stream_class.
711 @param[in] stream_class Stream class to add to \p trace_class.
712 @returns 0 on success, or a negative value on error.
714 @prenotnull{trace_class}
715 @prenotnull{stream_class}
716 @postrefcountsame{trace_class}
717 @postsuccessrefcountinc{stream_class}
718 @postsuccessfrozen{stream_class}
720 @sa bt_ctf_trace_get_stream_class_by_index(): Returns the stream class contained
721 in a given trace class at a given index.
722 @sa bt_ctf_trace_get_stream_class_by_id(): Finds a stream class by ID.
724 extern int bt_ctf_trace_add_stream_class(struct bt_ctf_trace
*trace_class
,
725 struct bt_ctf_stream_class
*stream_class
);
730 @name Stream children functions
735 @brief Returns the number of streams contained in the CTF IR trace
736 class \p trace_class.
738 @param[in] trace_class Trace class of which to get the number
740 @returns Number of children streams
741 contained in \p trace_class, or a negative
744 @prenotnull{trace_class}
745 @postrefcountsame{trace_class}
747 extern int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace
*trace_class
);
750 @brief Returns the stream at index \p index in the CTF IR trace
751 class \p trace_class.
753 @param[in] trace_class Trace class of which to get the stream.
754 @param[in] index Index of the stream to find.
755 @returns Stream at index \p index, or \c NULL
758 @prenotnull{trace_class}
759 @pre \p index is lesser than the number of streams contained in
760 the trace class \p trace_class (see
761 bt_ctf_trace_get_stream_count()).
762 @postrefcountsame{trace_class}
764 extern struct bt_ctf_stream
*bt_ctf_trace_get_stream_by_index(
765 struct bt_ctf_trace
*trace_class
, uint64_t index
);
770 @name Misc. functions
775 @brief Returns whether or not the CTF IR trace class \p trace_class
778 It is guaranteed that a static trace class will never contain new
779 streams, stream classes, or clock classes. A static class is always
782 This function returns \c true if bt_ctf_trace_set_is_static() was
783 previously called on it.
785 @param[in] trace_class Trace class to check.
786 @returns \c true if \p trace_class is static,
788 @sa bt_ctf_trace_set_is_static(): Makes a trace class static.
790 extern bool bt_ctf_trace_is_static(struct bt_ctf_trace
*trace_class
);
793 @brief Makes the CTF IR trace class \p trace_class static.
795 A static trace class is frozen and you cannot call any modifying
798 - bt_ctf_trace_add_stream_class()
799 - bt_ctf_trace_add_clock_class()
801 You cannot create a stream with bt_ctf_stream_create() with any of the
802 stream classes of a static trace class.
804 @param[in] trace_class Trace class to make static.
805 @returns 0 on success, or a negative value on error.
807 @prenotnull{trace_class}
808 @postrefcountsame{trace_class}
809 @postsuccessfrozen{trace_class}
811 @sa bt_ctf_trace_is_static(): Checks whether or not a given trace class
814 extern int bt_ctf_trace_set_is_static(struct bt_ctf_trace
*trace_class
);
817 @brief Accepts the visitor \p visitor to visit the hierarchy of the
818 CTF IR trace class \p trace_class.
820 This function traverses the hierarchy of \p trace_class in pre-order
821 and calls \p visitor on each element.
823 The trace class itself is visited first, then, for each children stream
824 class, the stream class itself, and all its children event classes.
826 @param[in] trace_class Trace class to visit.
827 @param[in] visitor Visiting function.
828 @param[in] data User data.
829 @returns 0 on success, or a negative value on error.
831 @prenotnull{trace_class}
834 extern int bt_ctf_trace_visit(struct bt_ctf_trace
*trace_class
,
835 bt_ctf_visitor visitor
, void *data
);
842 * bt_ctf_trace_get_metadata_string: get metadata string.
844 * Get the trace's TSDL metadata. The caller assumes the ownership of the
847 * @param trace Trace instance.
849 * Returns the metadata string on success, NULL on error.
851 extern char *bt_ctf_trace_get_metadata_string(struct bt_ctf_trace
*trace
);
857 #endif /* BABELTRACE_CTF_IR_TRACE_H */