lib: update and simplify the `bt_object` API
[babeltrace.git] / lib / lib-logging.c
index 214c2e3ae2c36f91ce357fcf4adf1b4d054ed861..b2d0954793969bce1bee162335928cf22a907019 100644 (file)
@@ -32,7 +32,6 @@
 #include <glib.h>
 #include <babeltrace/common-internal.h>
 #include <babeltrace/lib-logging-internal.h>
-#include <babeltrace/ref-internal.h>
 #include <babeltrace/values-internal.h>
 #include <babeltrace/object-pool-internal.h>
 #include <babeltrace/ctf-ir/field-types-internal.h>
@@ -66,7 +65,6 @@
 #include <babeltrace/graph/graph-internal.h>
 #include <babeltrace/graph/notification-discarded-elements-internal.h>
 #include <babeltrace/graph/notification-event-internal.h>
-#include <babeltrace/graph/notification-heap-internal.h>
 #include <babeltrace/graph/notification-inactivity-internal.h>
 #include <babeltrace/graph/notification-internal.h>
 #include <babeltrace/graph/notification-iterator-internal.h>
@@ -132,10 +130,10 @@ static inline void format_port(char **buf_ch, bool extended,
 static inline void format_connection(char **buf_ch, bool extended,
                const char *prefix, struct bt_connection *connection);
 
-static inline void format_ref_count(char **buf_ch, bool extended,
+static inline void format_object(char **buf_ch, bool extended,
                const char *prefix, struct bt_object *obj)
 {
-       BUF_APPEND(", %sref-count=%lu", prefix, obj->ref_count.count);
+       BUF_APPEND(", %sref-count=%llu", prefix, obj->ref_count);
 }
 
 static inline void format_object_pool(char **buf_ch, bool extended,
@@ -335,10 +333,10 @@ static inline void format_field_common(char **buf_ch, bool extended,
                struct bt_field_common_string *str =
                        BT_FROM_COMMON(field);
 
-               if (str->payload) {
-                       BT_ASSERT(str->payload);
+               if (str->buf) {
+                       BT_ASSERT(str->buf->data);
                        BUF_APPEND(", %spartial-value=\"%.32s\"",
-                               PRFIELD(str->payload->str));
+                               PRFIELD(str->buf->data));
 
                }
                break;
@@ -586,6 +584,9 @@ static inline void format_stream_class(char **buf_ch, bool extended,
        SET_TMP_PREFIX("ehf-pool-");
        format_object_pool(buf_ch, extended, prefix,
                &stream_class->event_header_field_pool);
+       SET_TMP_PREFIX("pcf-pool-");
+       format_object_pool(buf_ch, extended, prefix,
+               &stream_class->packet_context_field_pool);
 }
 
 static inline void format_writer_stream_class(char **buf_ch, bool extended,
@@ -711,7 +712,7 @@ static inline void format_stream_common(char **buf_ch, bool extended,
                return;
        }
 
-       trace = (void *) bt_object_borrow_parent(stream);
+       trace = (void *) bt_object_borrow_parent(&stream->base);
        if (!trace) {
                return;
        }
@@ -806,7 +807,7 @@ static inline void format_packet(char **buf_ch, bool extended,
        BUF_APPEND(", %sstream-addr=%p", PRFIELD(stream));
        SET_TMP_PREFIX("stream-");
        format_stream(buf_ch, false, tmp_prefix, stream);
-       trace = (struct bt_trace *) bt_object_borrow_parent(stream);
+       trace = (struct bt_trace *) bt_object_borrow_parent(&stream->common.base);
        if (!trace) {
                return;
        }
@@ -1038,7 +1039,8 @@ static inline void format_notification(char **buf_ch, bool extended,
                return;
        }
 
-       BUF_APPEND(", %sis-frozen=%d", PRFIELD(notif->frozen));
+       BUF_APPEND(", %sis-frozen=%d, %sgraph-addr=%p",
+               PRFIELD(notif->frozen), PRFIELD(notif->graph));
 
        switch (notif->type) {
        case BT_NOTIFICATION_TYPE_EVENT:
@@ -1240,6 +1242,8 @@ static inline void format_connection(char **buf_ch, bool extended,
 static inline void format_graph(char **buf_ch, bool extended,
                const char *prefix, struct bt_graph *graph)
 {
+       char tmp_prefix[64];
+
        BUF_APPEND(", %sis-canceled=%d", PRFIELD(graph->canceled));
 
        if (!extended) {
@@ -1255,6 +1259,16 @@ static inline void format_graph(char **buf_ch, bool extended,
                BUF_APPEND(", %sconn-count=%u",
                        PRFIELD(graph->connections->len));
        }
+
+       SET_TMP_PREFIX("en-pool-");
+       format_object_pool(buf_ch, extended, prefix,
+               &graph->event_notif_pool);
+       SET_TMP_PREFIX("pbn-pool-");
+       format_object_pool(buf_ch, extended, prefix,
+               &graph->packet_begin_notif_pool);
+       SET_TMP_PREFIX("pen-pool-");
+       format_object_pool(buf_ch, extended, prefix,
+               &graph->packet_end_notif_pool);
 }
 
 static inline void format_notification_iterator(char **buf_ch,
@@ -1310,9 +1324,6 @@ static inline void format_notification_iterator(char **buf_ch,
                SET_TMP_PREFIX("colander-comp-");
                format_component(buf_ch, false, tmp_prefix,
                        iter_output_port->colander);
-               SET_TMP_PREFIX("output-port-");
-               format_port(buf_ch, false, tmp_prefix,
-                       iter_output_port->output_port);
                break;
        }
        default:
@@ -1477,9 +1488,6 @@ static inline void handle_conversion_specifier_bt(void *priv_data,
        switch (cat) {
        case CAT_DEFAULT:
                switch (*fmt_ch) {
-               case 'r':
-                       format_ref_count(buf_ch, extended, prefix, obj);
-                       break;
                case 'F':
                        format_field_type(buf_ch, extended, prefix, obj);
                        break;
@@ -1543,6 +1551,9 @@ static inline void handle_conversion_specifier_bt(void *priv_data,
                case 'o':
                        format_object_pool(buf_ch, extended, prefix, obj);
                        break;
+               case 'O':
+                       format_object(buf_ch, extended, prefix, obj);
+                       break;
                default:
                        abort();
                }
This page took 0.027383 seconds and 4 git commands to generate.