tap-driver.sh: flush stdout after each test result
[babeltrace.git] / plugins / lttng-utils / debug-info / debug-info.c
index 1bdd01e565038dd5a807c6aed7eae9ef01618843..1e7a2381ed7fe062da9494c7c47c430d12141f70 100644 (file)
@@ -32,9 +32,9 @@
 #include <glib.h>
 #include <plugins-common.h>
 
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/common-internal.h>
-#include <babeltrace/fd-cache-internal.h>
+#include <babeltrace2/assert-internal.h>
+#include <babeltrace2/common-internal.h>
+#include <babeltrace2/fd-cache-internal.h>
 
 #include "bin-info.h"
 #include "debug-info.h"
@@ -1207,7 +1207,6 @@ bt_message *handle_event_message(struct debug_info_msg_iter *debug_it,
        const bt_clock_snapshot *cs;
        const bt_clock_class *default_cc;
        const bt_packet *in_packet;
-       bt_clock_snapshot_state cs_state;
        bt_event_class *out_event_class;
        bt_packet *out_packet;
        bt_event *out_event;
@@ -1239,12 +1238,10 @@ bt_message *handle_event_message(struct debug_info_msg_iter *debug_it,
                        bt_event_class_borrow_stream_class_const(in_event_class));
        if (default_cc) {
                /* Borrow event clock snapshot. */
-               cs_state =
-                       bt_message_event_borrow_default_clock_snapshot_const(
-                               in_message, &cs);
+               cs = bt_message_event_borrow_default_clock_snapshot_const(
+                               in_message);
 
                /* Create an output event message. */
-               BT_ASSERT (cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
                out_message = bt_message_event_create_with_default_clock_snapshot(
                                        debug_it->input_iterator,
                                        out_event_class, out_packet,
@@ -1337,8 +1334,7 @@ static
 bt_message *handle_packet_begin_message(struct debug_info_msg_iter *debug_it,
                const bt_message *in_message)
 {
-       const bt_clock_class *default_cc;
-       bt_clock_snapshot_state cs_state;
+       bool has_default_clock_snapshot;
        const bt_clock_snapshot *cs;
        bt_message *out_message = NULL;
        bt_packet *out_packet;
@@ -1356,17 +1352,16 @@ bt_message *handle_packet_begin_message(struct debug_info_msg_iter *debug_it,
 
        BT_ASSERT(out_packet);
 
-       default_cc = bt_stream_class_borrow_default_clock_class_const(
+       has_default_clock_snapshot =
+               bt_stream_class_packets_have_beginning_default_clock_snapshot(
                        bt_stream_borrow_class_const(
                                bt_packet_borrow_stream_const(in_packet)));
-       if (default_cc) {
+       if (has_default_clock_snapshot) {
                /* Borrow clock snapshot. */
-               cs_state =
-                       bt_message_packet_beginning_borrow_default_clock_snapshot_const(
-                                       in_message, &cs);
+               cs = bt_message_packet_beginning_borrow_default_clock_snapshot_const(
+                                       in_message);
 
                /* Create an output packet beginning message. */
-               BT_ASSERT(cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
                out_message = bt_message_packet_beginning_create_with_default_clock_snapshot(
                                debug_it->input_iterator, out_packet,
                                bt_clock_snapshot_get_value(cs));
@@ -1386,10 +1381,9 @@ static
 bt_message *handle_packet_end_message(struct debug_info_msg_iter *debug_it,
                const bt_message *in_message)
 {
+       bool has_default_clock_snapshot;
        const bt_clock_snapshot *cs;
        const bt_packet *in_packet;
-       const bt_clock_class *default_cc;
-       bt_clock_snapshot_state cs_state;
        bt_message *out_message = NULL;
        bt_packet *out_packet;
 
@@ -1399,17 +1393,16 @@ bt_message *handle_packet_end_message(struct debug_info_msg_iter *debug_it,
        out_packet = trace_ir_mapping_borrow_mapped_packet(debug_it->ir_maps, in_packet);
        BT_ASSERT(out_packet);
 
-       default_cc = bt_stream_class_borrow_default_clock_class_const(
+       has_default_clock_snapshot =
+               bt_stream_class_packets_have_end_default_clock_snapshot(
                        bt_stream_borrow_class_const(
                                bt_packet_borrow_stream_const(in_packet)));
-       if (default_cc) {
+       if (has_default_clock_snapshot) {
                /* Borrow clock snapshot. */
-               cs_state =
-                       bt_message_packet_end_borrow_default_clock_snapshot_const(
-                                       in_message, &cs);
+               cs = bt_message_packet_end_borrow_default_clock_snapshot_const(
+                                       in_message);
 
                /* Create an outpute packet end message. */
-               BT_ASSERT(cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
                out_message = bt_message_packet_end_create_with_default_clock_snapshot(
                                debug_it->input_iterator, out_packet,
                                bt_clock_snapshot_get_value(cs));
@@ -1547,9 +1540,8 @@ bt_message *handle_discarded_events_message(struct debug_info_msg_iter *debug_it
 {
        const bt_clock_snapshot *begin_cs, *end_cs;
        const bt_stream *in_stream;
-       const bt_clock_class *default_cc;
+       bool has_default_clock_snapshots;
        uint64_t discarded_events, begin_cs_value, end_cs_value;
-       bt_clock_snapshot_state begin_cs_state, end_cs_state;
        bt_property_availability prop_avail;
        bt_message *out_message = NULL;
        bt_stream *out_stream;
@@ -1562,22 +1554,16 @@ bt_message *handle_discarded_events_message(struct debug_info_msg_iter *debug_it
                                debug_it->ir_maps, in_stream);
        BT_ASSERT(out_stream);
 
-       default_cc = bt_stream_class_borrow_default_clock_class_const(
+       has_default_clock_snapshots =
+               bt_stream_class_discarded_events_have_default_clock_snapshots(
                        bt_stream_borrow_class_const(in_stream));
-       if (default_cc) {
-               begin_cs_state =
-                       bt_message_discarded_events_borrow_default_beginning_clock_snapshot_const(
-                                       in_message, &begin_cs);
-               end_cs_state =
-                       bt_message_discarded_events_borrow_default_end_clock_snapshot_const(
-                                       in_message, &end_cs);
-               /*
-                * Both clock snapshots should be known as we check that the
-                * all input stream classes have an always known clock. Unknown
-                * clock is not yet supported.
-                */
-               BT_ASSERT(begin_cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN &&
-                               end_cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
+       if (has_default_clock_snapshots) {
+               begin_cs =
+                       bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(
+                               in_message);
+               end_cs =
+                       bt_message_discarded_events_borrow_end_default_clock_snapshot_const(
+                               in_message);
 
                begin_cs_value = bt_clock_snapshot_get_value(begin_cs);
                end_cs_value = bt_clock_snapshot_get_value(end_cs);
@@ -1613,10 +1599,9 @@ bt_message *handle_discarded_packets_message(struct debug_info_msg_iter *debug_i
                const bt_message *in_message)
 {
        const bt_clock_snapshot *begin_cs, *end_cs;
-       const bt_clock_class *default_cc;
+       bool has_default_clock_snapshots;
        const bt_stream *in_stream;
        uint64_t discarded_packets, begin_cs_value, end_cs_value;
-       bt_clock_snapshot_state begin_cs_state, end_cs_state;
        bt_property_availability prop_avail;
        bt_message *out_message = NULL;
        bt_stream *out_stream;
@@ -1629,24 +1614,17 @@ bt_message *handle_discarded_packets_message(struct debug_info_msg_iter *debug_i
                        debug_it->ir_maps, in_stream);
        BT_ASSERT(out_stream);
 
-       default_cc = bt_stream_class_borrow_default_clock_class_const(
+       has_default_clock_snapshots =
+               bt_stream_class_discarded_packets_have_default_clock_snapshots(
                        bt_stream_borrow_class_const(in_stream));
-       if (default_cc) {
-               begin_cs_state =
-                       bt_message_discarded_packets_borrow_default_beginning_clock_snapshot_const(
-                                       in_message, &begin_cs);
-
-               end_cs_state =
-                       bt_message_discarded_packets_borrow_default_end_clock_snapshot_const(
-                                       in_message, &end_cs);
+       if (has_default_clock_snapshots) {
+               begin_cs =
+                       bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(
+                               in_message);
 
-               /*
-                * Both clock snapshots should be known as we check that the
-                * all input stream classes have an always known clock. Unknown
-                * clock is not yet supported.
-                */
-               BT_ASSERT(begin_cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN &&
-                               end_cs_state == BT_CLOCK_SNAPSHOT_STATE_KNOWN);
+               end_cs =
+                       bt_message_discarded_packets_borrow_end_default_clock_snapshot_const(
+                               in_message);
 
                begin_cs_value = bt_clock_snapshot_get_value(begin_cs);
                end_cs_value = bt_clock_snapshot_get_value(end_cs);
This page took 0.041674 seconds and 4 git commands to generate.