From a3c75374894ef3081dec483af8d0b5e891b4b9fa Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 8 Jul 2019 16:01:05 -0400 Subject: [PATCH] sink.text.details: write discarded events/packets CS props when supported It is known that, for a given stream class, when discarded events and packets are not supported, they also don't have default clock snapshots. This patch makes the output go from: Trace class: Stream class (ID 0): Packets have beginning default clock snapshot: Yes Packets have end default clock snapshot: Yes Supports discarded events: No Discarded events have default clock snapshots: No Supports discarded packets: No Discarded packets have default clock snapshots: No to: Trace class: Stream class (ID 0): Packets have beginning default clock snapshot: Yes Packets have end default clock snapshot: Yes Supports discarded events: No Supports discarded packets: No so as to remove some noise. Signed-off-by: Philippe Proulx Change-Id: Ib8c32a2dcad1ea51fedb37ca8a73d7255df0972e Reviewed-on: https://review.lttng.org/c/babeltrace/+/1651 Reviewed-by: Simon Marchi --- src/plugins/text/details/write.c | 19 +++++++++++++------ .../src.ctf.fs/succeed/trace-simple.expect | 1 - .../succeed/trace-smalltrace.expect | 2 -- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/plugins/text/details/write.c b/src/plugins/text/details/write.c index 788416d8..0ccad622 100644 --- a/src/plugins/text/details/write.c +++ b/src/plugins/text/details/write.c @@ -1033,15 +1033,22 @@ void write_stream_class(struct details_write_ctx *ctx, 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)) { diff --git a/tests/data/plugins/src.ctf.fs/succeed/trace-simple.expect b/tests/data/plugins/src.ctf.fs/succeed/trace-simple.expect index c5923ca1..6f62034b 100644 --- a/tests/data/plugins/src.ctf.fs/succeed/trace-simple.expect +++ b/tests/data/plugins/src.ctf.fs/succeed/trace-simple.expect @@ -5,7 +5,6 @@ Trace class: Supports discarded events: Yes Discarded events have default clock snapshots: Yes Supports discarded packets: No - Discarded packets have default clock snapshots: No Default clock class: Name: default Frequency (Hz): 1,000,000,000 diff --git a/tests/data/plugins/src.ctf.fs/succeed/trace-smalltrace.expect b/tests/data/plugins/src.ctf.fs/succeed/trace-smalltrace.expect index 7aad423a..39a740f6 100644 --- a/tests/data/plugins/src.ctf.fs/succeed/trace-smalltrace.expect +++ b/tests/data/plugins/src.ctf.fs/succeed/trace-smalltrace.expect @@ -3,9 +3,7 @@ Trace class: Packets have beginning default clock snapshot: No Packets have end default clock snapshot: No Supports discarded events: No - Discarded events have default clock snapshots: No Supports discarded packets: No - Discarded packets have default clock snapshots: No Event class `string` (ID 0): Payload field class: Structure (1 member): str: String -- 2.34.1