sink.text.details: show stream class namespace
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 9 Mar 2022 16:47:04 +0000 (11:47 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
If the stream class has a namespace (a property introduced with MIP 1),
show it when dumping the stream class info.

Add a `with-stream-class-namespace` parameter to the component class,
controlling whether to show the namespace or not.

Example output:

    Trace class:
      Stream class `da-name` (Namespace `da-namespace`, ID 0):

Philippe updated the manual page to document the
`with-stream-class-namespace` parameter.

Change-Id: I1a3854d266f8f7a87be09ed44c70e03ac9cc6912
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7529
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12693

doc/man/babeltrace2-sink.text.details.7.txt
src/plugins/text/details/details.c
src/plugins/text/details/details.h
src/plugins/text/details/write.c

index 8a23dd4e49fccd475d4c10312902b2f58d52dec7..b696d5d8c28939643046a251c90918bb03d367c6 100644 (file)
@@ -85,8 +85,8 @@ objects which it did not print yet. You can use the param:with-metadata
 parameter to disable this.
 
 You can hide specific properties with the param:with-stream-class-name,
-param:with-stream-name, param:with-time, param:with-trace-name, and
-param:with-uuid parameters.
+param:with-stream-class-namespace, param:with-stream-name,
+param:with-time, param:with-trace-name, and param:with-uuid parameters.
 
 To make the component hide many message details and print a single
 message per line, you can enable the compact mode with the param:compact
@@ -135,6 +135,11 @@ param:with-stream-class-name='VAL' vtype:[optional boolean]::
 +
 Default: true.
 
+param:with-stream-class-namespace='VAL' vtype:[optional boolean]::
+    If 'VAL' is false, then do not print stream class namespaces.
++
+Default: true.
+
 param:with-stream-name='VAL' vtype:[optional boolean]::
     If 'VAL' is false, then do not print stream names.
 +
index a685e201bdb842bf48030249412773565dc94da9..c484e0559f41f0375297c4021c91a415757b3648 100644 (file)
@@ -26,6 +26,7 @@
 #define WITH_TIME_PARAM_NAME "with-time"
 #define WITH_TRACE_NAME_PARAM_NAME "with-trace-name"
 #define WITH_STREAM_CLASS_NAME_PARAM_NAME "with-stream-class-name"
+#define WITH_STREAM_CLASS_NAMESPACE_PARAM_NAME "with-stream-class-namespace"
 #define WITH_STREAM_NAME_PARAM_NAME "with-stream-name"
 #define WITH_UUID_PARAM_NAME "with-uuid"
 #define COMPACT_PARAM_NAME "compact"
@@ -222,6 +223,7 @@ static const struct bt_param_validation_map_value_entry_descr details_params[] =
        { COMPACT_PARAM_NAME, BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
        { WITH_TIME_PARAM_NAME, BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
        { WITH_TRACE_NAME_PARAM_NAME, BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
+       { WITH_STREAM_CLASS_NAMESPACE_PARAM_NAME, BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
        { WITH_STREAM_CLASS_NAME_PARAM_NAME, BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
        { WITH_STREAM_NAME_PARAM_NAME, BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
        { WITH_UUID_PARAM_NAME, BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { .type = BT_VALUE_TYPE_BOOL } },
@@ -293,6 +295,10 @@ bt_component_class_initialize_method_status configure_details_comp(
        configure_bool_opt(params, WITH_STREAM_CLASS_NAME_PARAM_NAME, true,
                &details_comp->cfg.with_stream_class_name);
 
+       /* With stream class namespace? */
+       configure_bool_opt(params, WITH_STREAM_CLASS_NAMESPACE_PARAM_NAME, true,
+               &details_comp->cfg.with_stream_class_ns);
+
        /* With stream name? */
        configure_bool_opt(params, WITH_STREAM_NAME_PARAM_NAME, true,
                &details_comp->cfg.with_stream_name);
@@ -322,6 +328,8 @@ void log_configuration(bt_self_component_sink *comp,
        BT_COMP_LOGI("  With metadata: %d", details_comp->cfg.with_meta);
        BT_COMP_LOGI("  With time: %d", details_comp->cfg.with_time);
        BT_COMP_LOGI("  With trace name: %d", details_comp->cfg.with_trace_name);
+       BT_COMP_LOGI("  With stream class namespace: %d",
+               details_comp->cfg.with_stream_class_ns);
        BT_COMP_LOGI("  With stream class name: %d",
                details_comp->cfg.with_stream_class_name);
        BT_COMP_LOGI("  With stream name: %d", details_comp->cfg.with_stream_name);
index 89bddad8177ea829254e514deaef573d9653813a..6adda8a6ed84b8d5beabb4722f2e1efacc78eb87 100644 (file)
@@ -88,6 +88,9 @@ struct details_comp {
                /* Write trace's name */
                bool with_trace_name;
 
+               /* Write stream class's namespace */
+               bool with_stream_class_ns;
+
                /* Write stream class's name */
                bool with_stream_class_name;
 
index df3f28a9eb37978dcac5a5b932d94feb58257516..5cc023c0afd79115e538c60de396f489a2665d96 100644 (file)
@@ -1516,7 +1516,7 @@ void write_stream_class(struct details_write_ctx *ctx,
        write_indent(ctx);
        write_obj_type_name(ctx, "Stream class");
 
-       /* Write name and ID */
+       /* Write name, namespace and ID */
        if (ctx->details_comp->cfg.with_stream_class_name) {
                const char *name = bt_stream_class_get_name(sc);
 
@@ -1527,7 +1527,20 @@ void write_stream_class(struct details_write_ctx *ctx,
                }
        }
 
-       g_string_append(ctx->str, " (ID ");
+       g_string_append(ctx->str, " (");
+
+       if (ctx->details_comp->cfg.with_stream_class_ns
+                       && ctx->details_comp->mip_version >= 1) {
+               const char *ns = bt_stream_class_get_namespace(sc);
+
+               if (ns) {
+                       g_string_append(ctx->str, "Namespace `");
+                       write_str_prop_value(ctx, ns);
+                       g_string_append(ctx->str, "`, ");
+               }
+       }
+
+       g_string_append(ctx->str, "ID ");
        write_uint_prop_value(ctx, bt_stream_class_get_id(sc));
        g_string_append(ctx->str, "):\n");
 
This page took 0.026267 seconds and 4 git commands to generate.