X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Ftrace-internal.h;h=30b0ba4f697a62d2c0f6aef05e264f10cb13fe80;hb=7b33a0e0d8f23d90285ea7c7820a725bcbd96c6b;hp=f49e85bc1d09d7f7dbf1d013a8bda0ebeaf43c54;hpb=5b876b066f8c4022939c7ba05c7b6e94a585653d;p=babeltrace.git diff --git a/include/babeltrace/ctf-ir/trace-internal.h b/include/babeltrace/ctf-ir/trace-internal.h index f49e85bc..30b0ba4f 100644 --- a/include/babeltrace/ctf-ir/trace-internal.h +++ b/include/babeltrace/ctf-ir/trace-internal.h @@ -27,113 +27,80 @@ * SOFTWARE. */ +#include #include +#include #include #include +#include +#include #include +#include #include #include +#include #include #include -#include - -enum field_type_alias { - FIELD_TYPE_ALIAS_UINT5_T = 0, - FIELD_TYPE_ALIAS_UINT8_T, - FIELD_TYPE_ALIAS_UINT16_T, - FIELD_TYPE_ALIAS_UINT27_T, - FIELD_TYPE_ALIAS_UINT32_T, - FIELD_TYPE_ALIAS_UINT64_T, - NR_FIELD_TYPE_ALIAS, -}; +#include -struct bt_ctf_trace { +struct bt_trace { struct bt_object base; - GString *name; - int frozen; - uuid_t uuid; - bool uuid_set; - enum bt_ctf_byte_order native_byte_order; - struct bt_value *environment; - GPtrArray *clocks; /* Array of pointers to bt_ctf_clock_class */ - GPtrArray *stream_classes; /* Array of ptrs to bt_ctf_stream_class */ - GPtrArray *streams; /* Array of ptrs to bt_ctf_stream */ - struct bt_ctf_field_type *packet_header_type; - int64_t next_stream_id; - int is_created_by_writer; - /* - * This flag indicates if the trace is valid. A valid - * trace is _always_ frozen. - */ - int valid; - GPtrArray *listeners; /* Array of struct listener_wrapper */ - bool is_static; -}; + struct { + GString *str; -struct metadata_context { - GString *string; - GString *field_name; - unsigned int current_indentation_level; -}; + /* NULL or `str->str` above */ + const char *value; + } name; -BT_HIDDEN -const char *get_byte_order_string(int byte_order); + struct { + uint8_t uuid[BABELTRACE_UUID_LEN]; -BT_HIDDEN -struct bt_ctf_field_type *get_field_type(enum field_type_alias alias); + /* NULL or `uuid` above */ + bt_uuid value; + } uuid; -BT_HIDDEN -int bt_ctf_trace_object_modification(struct bt_ctf_object *object, - void *trace_ptr); + struct bt_value *environment; -BT_HIDDEN -bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace, - struct bt_ctf_clock_class *clock_class); + /* Array of `struct bt_stream_class *` */ + GPtrArray *stream_classes; -/** -@brief User function type to use with bt_ctf_trace_add_listener(). + /* Array of `struct bt_stream *` */ + GPtrArray *streams; -@param[in] obj New CTF IR object which is part of the trace - class hierarchy. -@param[in] data User data. + /* + * Stream class (weak) to number of instantiated streams, used + * to automatically assign stream IDs per stream class. + */ + GHashTable *stream_classes_stream_count; -@prenotnull{obj} -*/ -typedef void (*bt_ctf_listener_cb)(struct bt_ctf_object *obj, void *data); + struct bt_field_type *packet_header_ft; + bool assigns_automatic_stream_class_id; -/** -@brief Adds the trace class modification listener \p listener to - the CTF IR trace class \p trace_class. + GArray *is_static_listeners; + bool is_static; + bool in_remove_listener; -Once you add \p listener to \p trace_class, whenever \p trace_class -is modified, \p listener is called with the new element and with -\p data (user data). + /* Pool of `struct bt_field_wrapper *` */ + struct bt_object_pool packet_header_field_pool; -@param[in] trace_class Trace class to which to add \p listener. -@param[in] listener Modification listener function. -@param[in] data User data. -@returns 0 on success, or a negative value on error. + bool frozen; +}; -@prenotnull{trace_class} -@prenotnull{listener} -@postrefcountsame{trace_class} -*/ BT_HIDDEN -int bt_ctf_trace_add_listener(struct bt_ctf_trace *trace_class, - bt_ctf_listener_cb listener, void *data); +void _bt_trace_freeze(struct bt_trace *trace); + +#ifdef BT_DEV_MODE +# define bt_trace_freeze _bt_trace_freeze +#else +# define bt_trace_freeze(_trace) +#endif + +BT_HIDDEN +void bt_trace_add_stream(struct bt_trace *trace, struct bt_stream *stream); -/* - * bt_ctf_trace_get_metadata_string: get metadata string. - * - * Get the trace's TSDL metadata. The caller assumes the ownership of the - * returned string. - * - * @param trace Trace instance. - * - * Returns the metadata string on success, NULL on error. - */ BT_HIDDEN -char *bt_ctf_trace_get_metadata_string(struct bt_ctf_trace *trace); +uint64_t bt_trace_get_automatic_stream_id(struct bt_trace *trace, + struct bt_stream_class *stream_class); #endif /* BABELTRACE_CTF_IR_TRACE_INTERNAL_H */