+ }
+
+ bt_value_map_foreach(value, print_map_value, &indent);
+ break;
+ default:
+ assert(false);
+ }
+}
+
+static
+void print_bt_config_component(struct bt_config_component *bt_config_component)
+{
+ printf(" %s.%s:\n", bt_config_component->plugin_name->str,
+ bt_config_component->component_name->str);
+ printf(" Parameters:\n");
+ print_value(bt_config_component->params, 8);
+}
+
+static
+void print_bt_config_components(GPtrArray *array)
+{
+ size_t i;
+
+ for (i = 0; i < array->len; i++) {
+ struct bt_config_component *cfg_component =
+ bt_config_get_component(array, i);
+ print_bt_config_component(cfg_component);
+ BT_PUT(cfg_component);
+ }
+}
+
+static
+void print_plugin_paths(struct bt_value *plugin_paths)
+{
+ printf(" Plugin paths:\n");
+ print_value(plugin_paths, 4);
+}
+
+static
+void print_cfg_convert(struct bt_config *cfg)
+{
+ printf(" Force correlate: %s\n",
+ cfg->cmd_data.convert.force_correlate ? "yes" : "no");
+ print_plugin_paths(cfg->cmd_data.convert.plugin_paths);
+ printf(" Source component instances:\n");
+ print_bt_config_components(cfg->cmd_data.convert.sources);
+ printf(" Sink component instances:\n");
+ print_bt_config_components(cfg->cmd_data.convert.sinks);
+}
+
+static
+void print_cfg_list_plugins(struct bt_config *cfg)
+{
+ print_plugin_paths(cfg->cmd_data.list_plugins.plugin_paths);
+}
+
+static
+void print_cfg(struct bt_config *cfg)
+{
+ if (!babeltrace_verbose) {
+ return;
+ }
+
+ printf("Configuration:\n");
+ printf(" Debug mode: %s\n", cfg->debug ? "yes" : "no");
+ printf(" Verbose mode: %s\n", cfg->verbose ? "yes" : "no");
+
+ switch (cfg->command) {
+ case BT_CONFIG_COMMAND_CONVERT:
+ print_cfg_convert(cfg);
+ break;
+ case BT_CONFIG_COMMAND_LIST_PLUGINS:
+ print_cfg_list_plugins(cfg);
+ break;
+ default:
+ assert(false);
+ }
+}
+
+static
+struct bt_component *create_trimmer(struct bt_config_component *source_cfg)
+{
+ struct bt_component *trimmer = NULL;
+ struct bt_component_class *trimmer_class = NULL;
+ struct bt_value *trimmer_params = NULL;
+ struct bt_value *value;
+
+ trimmer_params = bt_value_map_create();
+ if (!trimmer_params) {
+ goto end;
+ }
+
+ value = bt_value_map_get(source_cfg->params, "begin");
+ if (value) {
+ enum bt_value_status ret;
+
+ ret = bt_value_map_insert(trimmer_params, "begin",
+ value);
+ BT_PUT(value);
+ if (ret) {
+ goto end;
+ }
+ }
+ value = bt_value_map_get(source_cfg->params, "end");
+ if (value) {
+ enum bt_value_status ret;
+
+ ret = bt_value_map_insert(trimmer_params, "end",
+ value);
+ BT_PUT(value);
+ if (ret) {
+ goto end;
+ }
+ }
+ value = bt_value_map_get(source_cfg->params, "clock-gmt");
+ if (value) {
+ enum bt_value_status ret;
+
+ ret = bt_value_map_insert(trimmer_params, "clock-gmt",
+ value);
+ BT_PUT(value);
+ if (ret) {