From: Simon Marchi Date: Wed, 2 Oct 2024 04:44:13 +0000 (-0400) Subject: sink.text.pretty: print trace UIDs (MIP 1) X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=a182dbb75c656c1d1b01b35c6ab7490290bc2e10;p=babeltrace.git sink.text.pretty: print trace UIDs (MIP 1) Adjust to MIP 1, where traces may have UIDs instead of UUIDS. Change-Id: If57f2ad1857e0b03f91f4226e11ecb63abdaef17 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/13310 Reviewed-by: Philippe Proulx Tested-by: jenkins --- diff --git a/src/plugins/text/pretty/pretty.c b/src/plugins/text/pretty/pretty.c index 4550f159..ac9761bf 100644 --- a/src/plugins/text/pretty/pretty.c +++ b/src/plugins/text/pretty/pretty.c @@ -578,6 +578,7 @@ bt_component_class_initialize_method_status pretty_init( goto error; } + pretty->mip_version = bt_self_component_get_graph_mip_version(self_comp); pretty->self_comp = self_comp; pretty->log_level = log_level; diff --git a/src/plugins/text/pretty/pretty.h b/src/plugins/text/pretty/pretty.h index 5438f9ff..745a7c20 100644 --- a/src/plugins/text/pretty/pretty.h +++ b/src/plugins/text/pretty/pretty.h @@ -63,6 +63,7 @@ struct pretty_options { struct pretty_component { struct pretty_options options; + uint64_t mip_version; bt_message_iterator *iterator; FILE *out, *err; int depth; /* nesting, used for tabulation alignment. */ diff --git a/src/plugins/text/pretty/print.c b/src/plugins/text/pretty/print.c index e3e52182..a5527f62 100644 --- a/src/plugins/text/pretty/print.c +++ b/src/plugins/text/pretty/print.c @@ -1517,6 +1517,7 @@ int print_discarded_elements_msg(struct pretty_component *pretty, const char *stream_name; const char *trace_name; bt_uuid trace_uuid; + const char *trace_uid; int64_t stream_class_id; int64_t stream_id; const char *init_msg; @@ -1543,8 +1544,12 @@ int print_discarded_elements_msg(struct pretty_component *pretty, trace_name = "(unknown)"; } - /* Trace UUID */ - trace_uuid = bt_trace_get_uuid(trace); + /* Trace UUID or UID */ + if (pretty->mip_version == 0) { + trace_uuid = bt_trace_get_uuid(trace); + } else { + trace_uid = bt_trace_get_uid(trace); + } /* Format message */ g_string_assign(pretty->string, ""); @@ -1584,12 +1589,22 @@ int print_discarded_elements_msg(struct pretty_component *pretty, bt_common_g_string_append_printf(pretty->string, " in trace \"%s\" ", trace_name); - if (trace_uuid) { - bt_common_g_string_append_printf(pretty->string, - "(UUID: " BT_UUID_FMT ") ", - BT_UUID_FMT_VALUES(trace_uuid)); + if (pretty->mip_version == 0) { + if (trace_uuid) { + bt_common_g_string_append_printf(pretty->string, + "(UUID: " BT_UUID_FMT ") ", + BT_UUID_FMT_VALUES(trace_uuid)); + } else { + bt_common_g_string_append(pretty->string, "(no UUID) "); + } } else { - bt_common_g_string_append(pretty->string, "(no UUID) "); + if (trace_uid) { + bt_common_g_string_append_printf(pretty->string, + "(UID: %s) ", trace_uid); + } else { + bt_common_g_string_append(pretty->string, "(no UID) "); + + } } bt_common_g_string_append_printf(pretty->string,