* rewrite `sc`.
*/
write_trace_class(ctx, tc);
- write_nl(ctx);
/*
* Mark this trace class as written, as well as all
* classes, so we don't need to rewrite `ec`.
*/
write_stream_class(ctx, sc);
- write_nl(ctx);
/*
* Mark this stream class as written, as well as all its
}
write_event_class(ctx, ec);
- write_nl(ctx);
details_did_write_meta_object(ctx, tc, ec);
goto end;
}
goto end;
}
+ if (!ctx->details_comp->cfg.with_data) {
+ goto end;
+ }
+
+ if (ctx->str->len > 0) {
+ /*
+ * Output buffer contains metadata: separate blocks with
+ * newline.
+ */
+ write_nl(ctx);
+ }
+
/* Write time */
if (bt_stream_class_borrow_default_clock_class_const(sc)) {
write_time(ctx,
decr_indent(ctx);
end:
-
return ret;
}
goto end;
}
+ if (!ctx->details_comp->cfg.with_data) {
+ goto end;
+ }
+
+ if (ctx->str->len > 0) {
+ /*
+ * Output buffer contains metadata: separate blocks with
+ * newline.
+ */
+ write_nl(ctx);
+ }
+
/* Write time */
if (cc) {
const bt_clock_snapshot *cs;
const bt_clock_class *cc =
bt_stream_class_borrow_default_clock_class_const(sc);
+ if (!ctx->details_comp->cfg.with_data) {
+ goto end;
+ }
+
/* Write time */
if (cc) {
const bt_clock_snapshot *cs;
const bt_stream_class *sc = bt_stream_borrow_class_const(stream);
const bt_field *field;
+ if (!ctx->details_comp->cfg.with_data) {
+ goto end;
+ }
+
/* Write time */
if (bt_stream_class_packets_have_beginning_default_clock_snapshot(sc)) {
write_time(ctx,
int write_discarded_events_message(struct details_write_ctx *ctx,
const bt_message *msg)
{
+ int ret = 0;
const bt_stream *stream = bt_message_discarded_events_borrow_stream_const(
msg);
const bt_stream_class *sc = bt_stream_borrow_class_const(stream);
const bt_clock_snapshot *end_cs = NULL;
uint64_t count;
+ if (!ctx->details_comp->cfg.with_data) {
+ goto end;
+ }
+
if (bt_stream_class_discarded_events_have_default_clock_snapshots(sc)) {
beginning_cs =
bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(
count = UINT64_C(-1);
}
- return write_discarded_items_message(ctx, "events", stream,
+ ret = write_discarded_items_message(ctx, "events", stream,
beginning_cs, end_cs, count);
+
+end:
+ return ret;
}
static
int write_discarded_packets_message(struct details_write_ctx *ctx,
const bt_message *msg)
{
+ int ret = 0;
const bt_stream *stream = bt_message_discarded_packets_borrow_stream_const(
msg);
const bt_stream_class *sc = bt_stream_borrow_class_const(stream);
const bt_clock_snapshot *end_cs = NULL;
uint64_t count;
+ if (!ctx->details_comp->cfg.with_data) {
+ goto end;
+ }
+
if (bt_stream_class_discarded_packets_have_default_clock_snapshots(sc)) {
beginning_cs =
bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(
count = UINT64_C(-1);
}
- return write_discarded_items_message(ctx, "packets", stream,
+ ret = write_discarded_items_message(ctx, "packets", stream,
beginning_cs, end_cs, count);
+
+end:
+ return ret;
}
static
const bt_stream *stream = bt_packet_borrow_stream_const(packet);
const bt_stream_class *sc = bt_stream_borrow_class_const(stream);
+ if (!ctx->details_comp->cfg.with_data) {
+ goto end;
+ }
+
/* Write time */
if (bt_stream_class_packets_have_end_default_clock_snapshot(sc)) {
write_time(ctx,
/* Reset output buffer */
g_string_assign(details_comp->str, "");
- if (details_comp->printed_something && !details_comp->cfg.compact) {
- write_nl(&ctx);
- }
-
switch (bt_message_get_type(msg)) {
case BT_MESSAGE_TYPE_EVENT:
ret = write_event_message(&ctx, msg);
abort();
}
+ /*
+ * If this component printed at least one character so far, and
+ * we're not in compact mode, and there's something in the
+ * output buffer for this message, then prepend a newline to the
+ * output buffer to visually separate message blocks.
+ */
+ if (details_comp->printed_something && !details_comp->cfg.compact &&
+ details_comp->str->len > 0) {
+ /* TODO: Optimize this */
+ g_string_prepend_c(details_comp->str, '\n');
+ }
+
return ret;
}