Babeltrace 2 C API  2.0.5
Open-source trace manipulation framework
trace.h
1 #ifndef BABELTRACE2_TRACE_IR_TRACE_H
2 #define BABELTRACE2_TRACE_IR_TRACE_H
3 
4 /*
5  * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
6  *
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:
13  *
14  * The above copyright notice and this permission notice shall be included in
15  * all copies or substantial portions of the Software.
16  *
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
23  * SOFTWARE.
24  */
25 
26 #ifndef __BT_IN_BABELTRACE_H
27 # error "Please include <babeltrace2/babeltrace.h> instead."
28 #endif
29 
30 #include <stdint.h>
31 
32 #include <babeltrace2/types.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
205 extern bt_trace *bt_trace_create(bt_trace_class *trace_class);
206 
231 
240  const bt_trace *trace);
241 
262 extern uint64_t bt_trace_get_stream_count(const bt_trace *trace);
263 
296  uint64_t index);
297 
306  const bt_trace *trace, uint64_t index);
307 
338  uint64_t id);
339 
348  const bt_trace *trace, uint64_t id);
349 
366  BT_TRACE_SET_NAME_STATUS_OK = __BT_FUNC_STATUS_OK,
367 
372  BT_TRACE_SET_NAME_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
374 
399  const char *name);
400 
425 extern const char *bt_trace_get_name(const bt_trace *trace);
426 
447 extern void bt_trace_set_uuid(bt_trace *trace, bt_uuid uuid);
448 
473 extern bt_uuid bt_trace_get_uuid(const bt_trace *trace);
474 
485 
490  BT_TRACE_SET_ENVIRONMENT_ENTRY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
492 
525 bt_trace_set_environment_entry_integer(bt_trace *trace, const char *name,
526  int64_t value);
527 
561 bt_trace_set_environment_entry_string(bt_trace *trace, const char *name,
562  const char *value);
563 
579 extern uint64_t bt_trace_get_environment_entry_count(const bt_trace *trace);
580 
628  const bt_trace *trace, uint64_t index,
629  const char **name, const bt_value **value);
630 
664  const bt_trace *trace, const char *name);
665 
693 extern void bt_trace_set_user_attributes(
694  bt_trace *trace, const bt_value *user_attributes);
695 
721 
730  const bt_trace *trace);
731 
761  const bt_trace *trace, void *user_data);
762 
772  BT_TRACE_ADD_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
773 
778  BT_TRACE_ADD_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
780 
819  const bt_trace *trace,
821  void *user_data, bt_listener_id *listener_id);
822 
832  BT_TRACE_REMOVE_LISTENER_STATUS_OK = __BT_FUNC_STATUS_OK,
833 
838  BT_TRACE_REMOVE_LISTENER_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
840 
872  const bt_trace *trace, bt_listener_id listener_id);
873 
896 extern void bt_trace_get_ref(const bt_trace *trace);
897 
913 extern void bt_trace_put_ref(const bt_trace *trace);
914 
929 #define BT_TRACE_PUT_REF_AND_RESET(_trace) \
930  do { \
931  bt_trace_put_ref(_trace); \
932  (_trace) = NULL; \
933  } while (0)
934 
960 #define BT_TRACE_MOVE_REF(_dst, _src) \
961  do { \
962  bt_trace_put_ref(_dst); \
963  (_dst) = (_src); \
964  (_src) = NULL; \
965  } while (0)
966 
971 #ifdef __cplusplus
972 }
973 #endif
974 
975 #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.
const char * bt_trace_get_name(const bt_trace *trace)
Returns the name of the trace trace.
void(* bt_trace_destruction_listener_func)(const bt_trace *trace, void *user_data)
User function for bt_trace_add_destruction_listener().
Definition: trace.h:760
bt_uuid bt_trace_get_uuid(const bt_trace *trace)
Returns the UUID of the trace trace.
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:767
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.
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:103
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). ...
bt_trace_set_environment_entry_status
Status codes for bt_trace_set_name().
Definition: trace.h:479
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:105
Out of memory.
Definition: trace.h:778
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:107
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:106
Out of memory.
Definition: trace.h:372
Success.
Definition: trace.h:832
uint64_t bt_listener_id
Numeric ID which identifies a user listener function.
Definition: types.h:150
Success.
Definition: trace.h:366
Success.
Definition: trace.h:772
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:361
Out of memory.
Definition: trace.h:490
Success.
Definition: trace.h:484
Out of memory.
Definition: trace.h:838
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:827
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:158