X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Ftext%2Fdetails%2Fwrite.c;h=1606599c28fec3a9c751fadf1de30d01b120df16;hb=26fc5aedf48df3f1654fe4d0b6ada1a10cd804f2;hp=b102485b48b519b40f3701271a29cec0bc0a6d27;hpb=335a2da576e59d32c17de2ece1e7e339c50e9c25;p=babeltrace.git diff --git a/src/plugins/text/details/write.c b/src/plugins/text/details/write.c index b102485b..1606599c 100644 --- a/src/plugins/text/details/write.c +++ b/src/plugins/text/details/write.c @@ -26,6 +26,7 @@ #include "common/assert.h" #include "common/common.h" +#include "common/uuid.h" #include "details.h" #include "write.h" #include "obj-lifetime-mgmt.h" @@ -329,24 +330,9 @@ void write_uuid_prop_line(struct details_write_ctx *ctx, const char *prop_name, write_indent(ctx); write_prop_name(ctx, prop_name); g_string_append_printf(ctx->str, - ": %s%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%s\n", + ": %s" BT_UUID_FMT "%s\n", color_bold(ctx), - (unsigned int) uuid[0], - (unsigned int) uuid[1], - (unsigned int) uuid[2], - (unsigned int) uuid[3], - (unsigned int) uuid[4], - (unsigned int) uuid[5], - (unsigned int) uuid[6], - (unsigned int) uuid[7], - (unsigned int) uuid[8], - (unsigned int) uuid[9], - (unsigned int) uuid[10], - (unsigned int) uuid[11], - (unsigned int) uuid[12], - (unsigned int) uuid[13], - (unsigned int) uuid[14], - (unsigned int) uuid[15], + BT_UUID_FMT_VALUES(uuid), color_reset(ctx)); } @@ -1039,23 +1025,36 @@ void write_stream_class(struct details_write_ctx *ctx, /* Write configuration */ write_bool_prop_line(ctx, - "Packets have beginning default clock snapshot", - bt_stream_class_packets_have_beginning_default_clock_snapshot(sc)); - write_bool_prop_line(ctx, - "Packets have end default clock snapshot", - bt_stream_class_packets_have_end_default_clock_snapshot(sc)); + "Supports packets", bt_stream_class_supports_packets(sc)); + + if (bt_stream_class_supports_packets(sc)) { + write_bool_prop_line(ctx, + "Packets have beginning default clock snapshot", + bt_stream_class_packets_have_beginning_default_clock_snapshot(sc)); + write_bool_prop_line(ctx, + "Packets have end default clock snapshot", + bt_stream_class_packets_have_end_default_clock_snapshot(sc)); + } + write_bool_prop_line(ctx, "Supports discarded events", bt_stream_class_supports_discarded_events(sc)); - write_bool_prop_line(ctx, - "Discarded events have default clock snapshots", - bt_stream_class_discarded_events_have_default_clock_snapshots(sc)); + + if (bt_stream_class_supports_discarded_events(sc)) { + write_bool_prop_line(ctx, + "Discarded events have default clock snapshots", + bt_stream_class_discarded_events_have_default_clock_snapshots(sc)); + } + write_bool_prop_line(ctx, "Supports discarded packets", bt_stream_class_supports_discarded_packets(sc)); - write_bool_prop_line(ctx, - "Discarded packets have default clock snapshots", - bt_stream_class_discarded_packets_have_default_clock_snapshots(sc)); + + if (bt_stream_class_supports_discarded_packets(sc)) { + write_bool_prop_line(ctx, + "Discarded packets have default clock snapshots", + bt_stream_class_discarded_packets_have_default_clock_snapshots(sc)); + } /* Write default clock class */ if (bt_stream_class_borrow_default_clock_class_const(sc)) { @@ -1769,6 +1768,7 @@ int write_stream_beginning_message(struct details_write_ctx *ctx, bt_message_stream_beginning_borrow_stream_const(msg); const bt_trace *trace = bt_stream_borrow_trace_const(stream); const bt_stream_class *sc = bt_stream_borrow_class_const(stream); + const bt_clock_class *cc = bt_stream_class_borrow_default_clock_class_const(sc); const bt_trace_class *tc = bt_stream_class_borrow_trace_class_const(sc); const char *name; @@ -1777,6 +1777,19 @@ int write_stream_beginning_message(struct details_write_ctx *ctx, goto end; } + /* Write time */ + if (cc) { + const bt_clock_snapshot *cs; + bt_message_stream_clock_snapshot_state cs_state = + bt_message_stream_beginning_borrow_default_clock_snapshot_const(msg, &cs); + + if (cs_state == BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN) { + write_time(ctx, cs); + } else { + write_time_str(ctx, "Unknown"); + } + } + /* Write follow tag for message */ ret = write_message_follow_tag(ctx, stream); if (ret) { @@ -1822,87 +1835,22 @@ int write_stream_end_message(struct details_write_ctx *ctx, int ret = 0; const bt_stream *stream = bt_message_stream_end_borrow_stream_const(msg); - - /* Write follow tag for message */ - ret = write_message_follow_tag(ctx, stream); - if (ret) { - goto end; - } - - /* Write stream properties */ - write_obj_type_name(ctx, "Stream end\n"); - -end: - return ret; -} - -static -int write_stream_activity_beginning_message(struct details_write_ctx *ctx, - const bt_message *msg) -{ - int ret = 0; - const bt_stream *stream = - bt_message_stream_activity_beginning_borrow_stream_const(msg); - bt_message_stream_activity_clock_snapshot_state cs_state; - const bt_clock_snapshot *cs = NULL; + const bt_stream_class *sc = + bt_stream_borrow_class_const(stream); + const bt_clock_class *cc = + bt_stream_class_borrow_default_clock_class_const(sc); /* Write time */ - cs_state = bt_message_stream_activity_beginning_borrow_default_clock_snapshot_const( - msg, &cs); - switch (cs_state) { - case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN: - BT_ASSERT(cs); - write_time(ctx, cs); - break; - case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN: - write_time_str(ctx, "Unknown"); - break; - case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE: - write_time_str(ctx, "-Infinity"); - break; - default: - abort(); - } - - /* Write follow tag for message */ - ret = write_message_follow_tag(ctx, stream); - if (ret) { - goto end; - } - - write_obj_type_name(ctx, "Stream activity beginning"); - write_nl(ctx); - -end: - return ret; -} - -static -int write_stream_activity_end_message(struct details_write_ctx *ctx, - const bt_message *msg) -{ - int ret = 0; - const bt_stream *stream = - bt_message_stream_activity_end_borrow_stream_const(msg); - bt_message_stream_activity_clock_snapshot_state cs_state; - const bt_clock_snapshot *cs = NULL; + if (cc) { + const bt_clock_snapshot *cs; + bt_message_stream_clock_snapshot_state cs_state = + bt_message_stream_end_borrow_default_clock_snapshot_const(msg, &cs); - /* Write time */ - cs_state = bt_message_stream_activity_end_borrow_default_clock_snapshot_const( - msg, &cs); - switch (cs_state) { - case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_KNOWN: - BT_ASSERT(cs); - write_time(ctx, cs); - break; - case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_UNKNOWN: - write_time_str(ctx, "Unknown"); - break; - case BT_MESSAGE_STREAM_ACTIVITY_CLOCK_SNAPSHOT_STATE_INFINITE: - write_time_str(ctx, "+Infinity"); - break; - default: - abort(); + if (cs_state == BT_MESSAGE_STREAM_CLOCK_SNAPSHOT_STATE_KNOWN) { + write_time(ctx, cs); + } else { + write_time_str(ctx, "Unknown"); + } } /* Write follow tag for message */ @@ -1911,8 +1859,8 @@ int write_stream_activity_end_message(struct details_write_ctx *ctx, goto end; } - write_obj_type_name(ctx, "Stream activity end"); - write_nl(ctx); + /* Write stream properties */ + write_obj_type_name(ctx, "Stream end\n"); end: return ret; @@ -2160,12 +2108,6 @@ int details_write_message(struct details_comp *details_comp, case BT_MESSAGE_TYPE_PACKET_END: ret = write_packet_end_message(&ctx, msg); break; - case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING: - ret = write_stream_activity_beginning_message(&ctx, msg); - break; - case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END: - ret = write_stream_activity_end_message(&ctx, msg); - break; case BT_MESSAGE_TYPE_DISCARDED_EVENTS: ret = write_discarded_events_message(&ctx, msg); break;