Babeltrace 2 C API  2.1.0
Open-source trace manipulation framework
trace.h
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5  */
6 
7 #ifndef BABELTRACE2_TRACE_IR_TRACE_H
8 #define BABELTRACE2_TRACE_IR_TRACE_H
9 
10 /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
11 
12 #ifndef __BT_IN_BABELTRACE_H
13 # error "Please include <babeltrace2/babeltrace.h> instead."
14 #endif
15 
16 #include <stdint.h>
17 
18 #include <babeltrace2/types.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
233 extern bt_trace *bt_trace_create(bt_trace_class *trace_class) __BT_NOEXCEPT;
234 
258 extern bt_trace_class *bt_trace_borrow_class(bt_trace *trace) __BT_NOEXCEPT;
259 
268  const bt_trace *trace) __BT_NOEXCEPT;
269 
290 extern uint64_t bt_trace_get_stream_count(const bt_trace *trace) __BT_NOEXCEPT;
291 
324  uint64_t index) __BT_NOEXCEPT;
325 
334  const bt_trace *trace, uint64_t index) __BT_NOEXCEPT;
335 
366  uint64_t id) __BT_NOEXCEPT;
367 
376  const bt_trace *trace, uint64_t id) __BT_NOEXCEPT;
377 
396  BT_TRACE_SET_NAMESPACE_STATUS_OK = __BT_FUNC_STATUS_OK,
397 
402  BT_TRACE_SET_NAMESPACE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
404 
432  const char *ns) __BT_NOEXCEPT;
433 
461 extern const char *bt_trace_get_namespace(const bt_trace *trace) __BT_NOEXCEPT;
462 
472  BT_TRACE_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
473 
478  BT_TRACE_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
480 
505  const char *name) __BT_NOEXCEPT;
506 
531 extern const char *bt_trace_get_name(const bt_trace *trace) __BT_NOEXCEPT;
532 
564 extern void bt_trace_set_uuid(bt_trace *trace, bt_uuid uuid) __BT_NOEXCEPT;
565 
601 extern bt_uuid bt_trace_get_uuid(const bt_trace *trace) __BT_NOEXCEPT;
602 
614  BT_TRACE_SET_UID_STATUS_OK = __BT_FUNC_STATUS_OK,
615 
620  BT_TRACE_SET_UID_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
622 
651 extern bt_trace_set_uid_status bt_trace_set_uid(bt_trace *trace, const char *uid);
652 
680 extern const char *bt_trace_get_uid(const bt_trace *trace);
681 
692 
697  BT_TRACE_SET_ENVIRONMENT_ENTRY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
699 
732 bt_trace_set_environment_entry_integer(bt_trace *trace, const char *name,
733  int64_t value) __BT_NOEXCEPT;
734 
768 bt_trace_set_environment_entry_string(bt_trace *trace, const char *name,
769  const char *value) __BT_NOEXCEPT;
770 
787  const bt_trace *trace) __BT_NOEXCEPT;
788 
836  const bt_trace *trace, uint64_t index,
837  const char **name, const bt_value **value) __BT_NOEXCEPT;
838 
872  const bt_trace *trace, const char *name) __BT_NOEXCEPT;
873 
902 extern void bt_trace_set_user_attributes(
903  bt_trace *trace, const bt_value *user_attributes) __BT_NOEXCEPT;
904 
929 extern bt_value *bt_trace_borrow_user_attributes(bt_trace *trace) __BT_NOEXCEPT;
930 
939  const bt_trace *trace) __BT_NOEXCEPT;
940 
970  const bt_trace *trace, void *user_data);
971 
981  BT_TRACE_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
982 
987  BT_TRACE_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
989 
1028  const bt_trace *trace,
1030  void *user_data, bt_listener_id *listener_id) __BT_NOEXCEPT;
1031 
1041  BT_TRACE_REMOVE_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
1042 
1047  BT_TRACE_REMOVE_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
1049 
1081  const bt_trace *trace, bt_listener_id listener_id)
1082  __BT_NOEXCEPT;
1083 
1106 extern void bt_trace_get_ref(const bt_trace *trace) __BT_NOEXCEPT;
1107 
1123 extern void bt_trace_put_ref(const bt_trace *trace) __BT_NOEXCEPT;
1124 
1139 #define BT_TRACE_PUT_REF_AND_RESET(_trace) \
1140  do { \
1141  bt_trace_put_ref(_trace); \
1142  (_trace) = NULL; \
1143  } while (0)
1144 
1170 #define BT_TRACE_MOVE_REF(_dst, _src) \
1171  do { \
1172  bt_trace_put_ref(_dst); \
1173  (_dst) = (_src); \
1174  (_src) = NULL; \
1175  } while (0)
1176 
1181 #ifdef __cplusplus
1182 }
1183 #endif
1184 
1185 #endif /* BABELTRACE2_TRACE_IR_TRACE_H */
const bt_trace_class * bt_trace_borrow_class_const(const bt_trace *trace)
Borrows the class of the trace trace (const version).
bt_trace_set_environment_entry_status bt_trace_set_environment_entry_integer(bt_trace *trace, const char *name, int64_t value)
Sets the value of the environment entry of the trace trace named name to the signed integer value...
bt_trace * bt_trace_create(bt_trace_class *trace_class)
Creates a default trace from the trace class trace_class.
Out of memory.
Definition: trace.h:402
const char * bt_trace_get_name(const bt_trace *trace)
Returns the name of the trace trace.
bt_trace_set_namespace_status bt_trace_set_namespace(bt_trace *trace, const char *ns)
Sets the namespace of the trace trace to a copy of ns.
void(* bt_trace_destruction_listener_func)(const bt_trace *trace, void *user_data)
User function for bt_trace_add_destruction_listener().
Definition: trace.h:969
const char * bt_trace_get_uid(const bt_trace *trace)
Returns the UID of the trace trace.
bt_uuid bt_trace_get_uuid(const bt_trace *trace)
Returns the UUID of the trace trace.
bt_trace_set_uid_status
Status codes for bt_trace_set_uid().
Definition: trace.h:609
bt_trace_set_namespace_status
Status codes for bt_trace_set_namespace().
Definition: trace.h:391
void bt_trace_get_ref(const bt_trace *trace)
Increments the reference count of the trace trace.
void bt_trace_borrow_environment_entry_by_index_const(const bt_trace *trace, uint64_t index, const char **name, const bt_value **value)
Borrows the environment entry at index index from the trace trace, setting *name to its name and *val...
const bt_value * bt_trace_borrow_user_attributes_const(const bt_trace *trace)
Borrows the user attributes of the trace trace (const version).
bt_trace_add_listener_status
Status codes for bt_trace_add_destruction_listener().
Definition: trace.h:976
uint64_t bt_trace_get_environment_entry_count(const bt_trace *trace)
Returns the number of environment entries contained in the trace trace.
bt_trace_class * bt_trace_borrow_class(bt_trace *trace)
Borrows the class of the trace trace.
Success.
Definition: trace.h:396
bt_trace_set_uid_status bt_trace_set_uid(bt_trace *trace, const char *uid)
Sets the unique identifier (UID) of trace to a copy of uid.
uint64_t bt_trace_get_stream_count(const bt_trace *trace)
Returns the number of streams contained in the trace trace.
struct bt_stream bt_stream
Stream.
Definition: types.h:89
bt_value * bt_trace_borrow_user_attributes(bt_trace *trace)
Borrows the user attributes of the trace trace.
const bt_stream * bt_trace_borrow_stream_by_id_const(const bt_trace *trace, uint64_t id)
Borrows the stream having the numeric ID id from the trace trace (const version). ...
Success.
Definition: trace.h:614
bt_trace_set_environment_entry_status
Status codes for bt_trace_set_name().
Definition: trace.h:686
const bt_stream * bt_trace_borrow_stream_by_index_const(const bt_trace *trace, uint64_t index)
Borrows the stream at index index from the trace trace (const version).
struct bt_trace bt_trace
Trace.
Definition: types.h:91
Out of memory.
Definition: trace.h:620
Out of memory.
Definition: trace.h:987
void bt_trace_set_uuid(bt_trace *trace, bt_uuid uuid)
Sets the UUID of the trace trace to a copy of uuid.
struct bt_value bt_value
Value.
Definition: types.h:93
bt_stream * bt_trace_borrow_stream_by_id(bt_trace *trace, uint64_t id)
Borrows the stream having the numeric ID id from the trace trace.
void bt_trace_set_user_attributes(bt_trace *trace, const bt_value *user_attributes)
Sets the user attributes of the trace trace to user_attributes.
bt_trace_set_name_status bt_trace_set_name(bt_trace *trace, const char *name)
Sets the name of the trace trace to a copy of name.
const bt_value * bt_trace_borrow_environment_entry_value_by_name_const(const bt_trace *trace, const char *name)
Borrows the value of the environment entry named name in the trace trace.
struct bt_trace_class bt_trace_class
Trace class.
Definition: types.h:92
Out of memory.
Definition: trace.h:478
Success.
Definition: trace.h:1041
uint64_t bt_listener_id
Numeric ID which identifies a user listener function.
Definition: types.h:136
Success.
Definition: trace.h:472
Success.
Definition: trace.h:981
bt_stream * bt_trace_borrow_stream_by_index(bt_trace *trace, uint64_t index)
Borrows the stream at index index from the trace trace.
bt_trace_add_listener_status bt_trace_add_destruction_listener(const bt_trace *trace, bt_trace_destruction_listener_func user_func, void *user_data, bt_listener_id *listener_id)
Adds a destruction listener having the function user_func to the trace trace.
bt_trace_set_name_status
Status codes for bt_trace_set_name().
Definition: trace.h:467
Out of memory.
Definition: trace.h:697
Success.
Definition: trace.h:691
Out of memory.
Definition: trace.h:1047
bt_trace_set_environment_entry_status bt_trace_set_environment_entry_string(bt_trace *trace, const char *name, const char *value)
Sets the value of the environment entry of the trace trace named name to the string value...
bt_trace_remove_listener_status
Status codes for bt_trace_remove_destruction_listener().
Definition: trace.h:1036
bt_trace_remove_listener_status bt_trace_remove_destruction_listener(const bt_trace *trace, bt_listener_id listener_id)
Removes the destruction listener having the ID listener_id from the trace trace.
void bt_trace_put_ref(const bt_trace *trace)
Decrements the reference count of the trace trace.
uint8_t const * bt_uuid
A UUID, that is, an array of 16 constant bytes.
Definition: types.h:144
const char * bt_trace_get_namespace(const bt_trace *trace)
Returns the namespace of the trace trace.