[verse]
*babeltrace2* [<<gen-opts,'GENERAL OPTIONS'>>] [*convert*] [opt:--retry-duration='TIME-US']
- 'TRACE-PATH'...
+ [opt:--allowed-mip-versions='VERSION'] 'TRACE-PATH'...
Convert one or more traces to a given format:
[verse]
*babeltrace2* [<<gen-opts,'GENERAL OPTIONS'>>] [*convert*] [opt:--retry-duration='TIME-US']
- 'CONVERSION ARGS'
+ [opt:--allowed-mip-versions='VERSION'] 'CONVERSION ARGS'
Get the equivalent man:babeltrace2-run(1) command arguments to convert
one or more traces to a given format:
[verse]
*babeltrace2* [<<gen-opts,'GENERAL OPTIONS'>>] [*convert*] [opt:--retry-duration='TIME-US']
+ [opt:--allowed-mip-versions='VERSION']
(opt:--run-args | opt:--run-args-0) 'CONVERSION ARGS'
Print the metadata text of a CTF trace:
=== Conversion graph configuration
+opt:-m 'VERSION'::
+opt:--allowed-mip-versions='VERSION'::
+ Only allow the conversion graph to honour version 'VERSION' (0 or 1)
+ of the Message Interchange Protocol (MIP) instead of allowing
+ both versions.
+
opt:--retry-duration='TIME-US'::
Set the duration of a single retry to 'TIME-US'~µs when a sink
component reports "try again later" (busy network or file system,
/* argpar options */
enum {
OPT_NONE = 0,
+ OPT_ALLOWED_MIP_VERSIONS,
OPT_BASE_PARAMS,
OPT_BEGIN,
OPT_CLOCK_CYCLES,
fprintf(fp, "\n");
fprintf(fp, "Options:\n");
fprintf(fp, "\n");
+ fprintf(fp, " -m, --allowed-mip-versions=VER Allow only the MIP version VER (0 or 1)\n");
+ fprintf(fp, " (default: all MIP versions are allowed)\n");
fprintf(fp, " -b, --base-params=PARAMS Set PARAMS as the current base parameters\n");
fprintf(fp, " for all the following components until\n");
fprintf(fp, " --reset-base-params is encountered\n");
bt_value *connection_args = NULL;
char error_buf[256] = { 0 };
long retry_duration = -1;
+ long allowed_mip_version = -1;
bt_value_map_extend_status extend_status;
GString *error_str = NULL;
struct argpar_iter *argpar_iter = NULL;
{ OPT_PARAMS, 'p', "params", true },
{ OPT_RESET_BASE_PARAMS, 'r', "reset-base-params", false },
{ OPT_RETRY_DURATION, '\0', "retry-duration", true },
+ { OPT_ALLOWED_MIP_VERSIONS, 'm', "allowed-mip-versions", true },
ARGPAR_OPT_DESCR_SENTINEL
};
}
cfg->cmd_data.run.retry_duration_us = 100000;
+ cfg->cmd_data.run.allow_mip_0 = true;
+ cfg->cmd_data.run.allow_mip_1 = true;
cur_base_params = bt_value_map_create();
if (!cur_base_params) {
BT_CLI_LOGE_APPEND_CAUSE_OOM();
(uint64_t) retry_duration;
break;
}
+ case OPT_ALLOWED_MIP_VERSIONS: {
+ gchar *end;
+ size_t arg_len = strlen(arg);
+
+ allowed_mip_version = g_ascii_strtoll(arg, &end, 10);
+
+ if (arg_len == 0 || end != (arg + arg_len)) {
+ BT_CLI_LOGE_APPEND_CAUSE(
+ "Could not parse --allowed-mip-versions option's argument as an unsigned integer: `%s`",
+ arg);
+ goto error;
+ }
+
+ if (allowed_mip_version < 0 || allowed_mip_version > 1) {
+ BT_CLI_LOGE_APPEND_CAUSE("--allowed-mip-versions option's argument must be 0 or 1: %ld",
+ allowed_mip_version);
+ goto error;
+ }
+
+ cfg->cmd_data.run.allow_mip_0 = (allowed_mip_version == 0);
+ cfg->cmd_data.run.allow_mip_1 = (allowed_mip_version == 1);
+ break;
+ }
default:
bt_common_abort();
}
fprintf(fp, "\n");
fprintf(fp, "Options:\n");
fprintf(fp, "\n");
+ fprintf(fp, " -m, --allowed-mip-versions=VER Allow only the MIP version VER (0 or 1)\n");
+ fprintf(fp, " (default: all MIP versions are allowed)\n");
fprintf(fp, " -c, --component=[NAME:]TYPE.PLUGIN.CLS\n");
fprintf(fp, " Instantiate the component class CLS of type\n");
fprintf(fp, " TYPE (`source`, `filter`, or `sink`) found\n");
static
const struct argpar_opt_descr convert_options[] = {
/* id, short_name, long_name, with_arg */
+ { OPT_ALLOWED_MIP_VERSIONS, 'm', "allowed-mip-versions", true },
{ OPT_BEGIN, 'b', "begin", true },
{ OPT_CLOCK_CYCLES, '\0', "clock-cycles", false },
{ OPT_CLOCK_DATE, '\0', "clock-date", false },
goto error;
}
+ if (bt_value_array_append_string_element(run_args, arg)) {
+ BT_CLI_LOGE_APPEND_CAUSE_OOM();
+ goto error;
+ }
+ break;
+ case OPT_ALLOWED_MIP_VERSIONS:
+ if (bt_value_array_append_string_element(run_args,
+ "--allowed-mip-versions")) {
+ BT_CLI_LOGE_APPEND_CAUSE_OOM();
+ goto error;
+ }
+
if (bt_value_array_append_string_element(run_args, arg)) {
BT_CLI_LOGE_APPEND_CAUSE_OOM();
goto error;
*default_log_level =
logging_level_min(*default_log_level, BT_LOG_TRACE);
break;
+ case OPT_ALLOWED_MIP_VERSIONS:
case OPT_COMPONENT:
case OPT_HELP:
case OPT_LOG_LEVEL:
bt_get_greatest_operative_mip_version_status status =
BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_OK;
bt_component_descriptor_set *comp_descr_set = NULL;
+ bt_integer_range_set_unsigned *mip_version_restriction = NULL;
int ret;
BT_ASSERT(cfg);
}
}
- status = bt_get_greatest_operative_mip_version(comp_descr_set,
- (bt_logging_level) bt_cli_log_level, mip_version);
+ /* Set MIP version restrictions if needed */
+ if (!cfg->cmd_data.run.allow_mip_0 || !cfg->cmd_data.run.allow_mip_1) {
+ mip_version_restriction = bt_integer_range_set_unsigned_create();
+ if (!mip_version_restriction) {
+ status = BT_GET_GREATEST_OPERATIVE_MIP_VERSION_STATUS_MEMORY_ERROR;
+ goto end;
+ }
+
+ if (cfg->cmd_data.run.allow_mip_0) {
+ bt_integer_range_set_add_range_status add_range_status =
+ bt_integer_range_set_unsigned_add_range(
+ mip_version_restriction, 0, 0);
+ if (add_range_status != BT_INTEGER_RANGE_SET_ADD_RANGE_STATUS_OK) {
+ status = (int) add_range_status;
+ goto end;
+ }
+ }
+
+ if (cfg->cmd_data.run.allow_mip_1) {
+ bt_integer_range_set_add_range_status add_range_status =
+ bt_integer_range_set_unsigned_add_range(
+ mip_version_restriction, 1, 1);
+ if (add_range_status != BT_INTEGER_RANGE_SET_ADD_RANGE_STATUS_OK) {
+ status = (int) add_range_status;
+ goto end;
+ }
+ }
+ }
+
+ status = bt_get_greatest_operative_mip_version_with_restriction(
+ comp_descr_set, (bt_logging_level) bt_cli_log_level,
+ mip_version_restriction, mip_version);
end:
+ bt_object_put_ref(mip_version_restriction);
bt_component_descriptor_set_put_ref(comp_descr_set);
return status;
}