static const char *opt_output_path;
int babeltrace_verbose, babeltrace_debug;
+int opt_field_names;
void strlower(char *str)
{
OPT_LIST,
OPT_VERBOSE,
OPT_DEBUG,
+ OPT_NAMES,
};
static struct poptOption long_options[] = {
{ "list", 'l', POPT_ARG_NONE, NULL, OPT_LIST, NULL, NULL },
{ "verbose", 'v', POPT_ARG_NONE, NULL, OPT_VERBOSE, NULL, NULL },
{ "debug", 'd', POPT_ARG_NONE, NULL, OPT_DEBUG, NULL, NULL },
+ { "names", 'n', POPT_ARG_NONE, NULL, OPT_NAMES, NULL, NULL },
{ NULL, 0, 0, NULL, 0, NULL, NULL },
};
fprintf(fp, " -l, --list List available formats\n");
fprintf(fp, " -v, --verbose Verbose mode\n");
fprintf(fp, " -d, --debug Debug mode\n");
+ fprintf(fp, " -n, --names Print field names\n");
list_formats(fp);
fprintf(fp, "\n");
}
case OPT_DEBUG:
babeltrace_debug = 1;
break;
+ case OPT_NAMES:
+ opt_field_names = 1;
+ break;
default:
ret = -EINVAL;
goto end;
if (stream_class->event_header) {
if (pos->print_names)
fprintf(pos->fp, ", stream.event.header =");
+ else
+ fprintf(pos->fp, ",");
fprintf(pos->fp, " ");
ret = generic_rw(ppos, &stream_class->event_header->p);
if (ret)
if (stream_class->event_context) {
if (pos->print_names)
fprintf(pos->fp, ", stream.event.context =");
+ else
+ fprintf(pos->fp, ",");
fprintf(pos->fp, " ");
ret = generic_rw(ppos, &stream_class->event_context->p);
if (ret)
if (event_class->context) {
if (pos->print_names)
fprintf(pos->fp, ", event.context =");
+ else
+ fprintf(pos->fp, ",");
fprintf(pos->fp, " ");
ret = generic_rw(ppos, &event_class->context->p);
if (ret)
if (event_class->fields) {
if (pos->print_names)
fprintf(pos->fp, ", event.fields =");
+ else
+ fprintf(pos->fp, ",");
fprintf(pos->fp, " ");
ret = generic_rw(ppos, &event_class->fields->p);
if (ret)
pos->fp = fp;
pos->parent.rw_table = write_dispatch_table;
pos->parent.event_cb = ctf_text_write_event;
- pos->print_names = 1;
+ pos->print_names = opt_field_names;
break;
case O_RDONLY:
default:
int ret;
if (!pos->dummy) {
- //print_pos_tabs(pos);
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (definition->index != INT_MAX)
ret = array_rw(ppos, definition);
if (!pos->dummy) {
pos->depth--;
- //print_pos_tabs(pos);
fprintf(pos->fp, " ]");
}
return ret;
fprintf(pos->fp, "%s = ",
g_quark_to_string(definition->name));
- //print_pos_tabs(pos);
fprintf(pos->fp, "(");
pos->depth++;
ret = generic_rw(ppos, &integer_definition->p);
- //print_pos_tabs(pos);
fprintf(pos->fp, " :");
qs = enum_definition->value;
fprintf(pos->fp, "%s\n", str);
}
pos->depth--;
- //print_pos_tabs(pos);
fprintf(pos->fp, " )");
return ret;
}
if (pos->dummy)
return 0;
- //print_pos_tabs(pos);
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
fprintf(pos->fp, "%s = ",
g_quark_to_string(definition->name));
- //print_pos_tabs(pos);
-
if (!compare_definition_path(definition, g_quark_from_static_string("stream.event.header.timestamp"))) {
- if (!pos->print_names)
- fprintf(pos->fp, "[%" PRIu64 "]",
- integer_definition->value._unsigned);
- else
- fprintf(pos->fp, "%" PRIu64,
- integer_definition->value._unsigned);
+ fprintf(pos->fp, "%" PRIu64,
+ integer_definition->value._unsigned);
return 0;
}
int ret;
if (!pos->dummy) {
- //print_pos_tabs(pos);
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (definition->index != INT_MAX)
ret = sequence_rw(ppos, definition);
if (!pos->dummy) {
pos->depth--;
- //print_pos_tabs(pos);
fprintf(pos->fp, " ]");
}
return ret;
assert(string_definition->value != NULL);
if (pos->dummy)
return 0;
- //print_pos_tabs(pos);
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (!pos->dummy) {
if (pos->depth >= 0) {
- //print_pos_tabs(pos);
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (definition->index != INT_MAX)
if (!pos->dummy) {
pos->depth--;
if (pos->depth >= 0) {
- //print_pos_tabs(pos);
fprintf(pos->fp, " }");
}
}
if (!pos->dummy) {
if (pos->depth >= 0) {
- //print_pos_tabs(pos);
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (definition->index != INT_MAX)
if (!pos->dummy) {
pos->depth--;
if (pos->depth >= 0) {
- //print_pos_tabs(pos);
fprintf(pos->fp, " }");
}
}
int convert_trace(struct trace_descriptor *td_write,
struct trace_descriptor *td_read);
+extern int opt_field_names;
+
#endif