projects
/
babeltrace.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3126235
)
Add -t option
author
Mathieu Desnoyers
<mathieu.desnoyers@efficios.com>
Mon, 9 May 2011 14:59:04 +0000
(10:59 -0400)
committer
Mathieu Desnoyers
<mathieu.desnoyers@efficios.com>
Mon, 9 May 2011 14:59:04 +0000
(10:59 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace.c
patch
|
blob
|
blame
|
history
formats/ctf-text/ctf-text.c
patch
|
blob
|
blame
|
history
formats/ctf-text/types/array.c
patch
|
blob
|
blame
|
history
formats/ctf-text/types/enum.c
patch
|
blob
|
blame
|
history
formats/ctf-text/types/float.c
patch
|
blob
|
blame
|
history
formats/ctf-text/types/integer.c
patch
|
blob
|
blame
|
history
formats/ctf-text/types/sequence.c
patch
|
blob
|
blame
|
history
formats/ctf-text/types/string.c
patch
|
blob
|
blame
|
history
formats/ctf-text/types/struct.c
patch
|
blob
|
blame
|
history
formats/ctf-text/types/variant.c
patch
|
blob
|
blame
|
history
include/babeltrace/babeltrace.h
patch
|
blob
|
blame
|
history
diff --git
a/converter/babeltrace.c
b/converter/babeltrace.c
index 64392d0c5aee66900cdca53db0dc190ddfcea6fa..9d4212241274a14d2a8934de3a81a28ef8af4ec3 100644
(file)
--- a/
converter/babeltrace.c
+++ b/
converter/babeltrace.c
@@
-33,6
+33,7
@@
static const char *opt_input_path;
static const char *opt_output_path;
int babeltrace_verbose, babeltrace_debug;
static const char *opt_output_path;
int babeltrace_verbose, babeltrace_debug;
+int opt_field_names;
void strlower(char *str)
{
void strlower(char *str)
{
@@
-48,6
+49,7
@@
enum {
OPT_LIST,
OPT_VERBOSE,
OPT_DEBUG,
OPT_LIST,
OPT_VERBOSE,
OPT_DEBUG,
+ OPT_NAMES,
};
static struct poptOption long_options[] = {
};
static struct poptOption long_options[] = {
@@
-58,6
+60,7
@@
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 },
{ "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 },
};
{ NULL, 0, 0, NULL, 0, NULL, NULL },
};
@@
-84,6
+87,7
@@
static void usage(FILE *fp)
fprintf(fp, " -l, --list List available formats\n");
fprintf(fp, " -v, --verbose Verbose mode\n");
fprintf(fp, " -d, --debug Debug mode\n");
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");
}
list_formats(fp);
fprintf(fp, "\n");
}
@@
-121,6
+125,9
@@
static int parse_options(int argc, char **argv)
case OPT_DEBUG:
babeltrace_debug = 1;
break;
case OPT_DEBUG:
babeltrace_debug = 1;
break;
+ case OPT_NAMES:
+ opt_field_names = 1;
+ break;
default:
ret = -EINVAL;
goto end;
default:
ret = -EINVAL;
goto end;
diff --git
a/formats/ctf-text/ctf-text.c
b/formats/ctf-text/ctf-text.c
index ceca3e4ea6c2b579bd63f44e3f992a5a3052cb9b..423cb10fe07da22eac99b4d113c2731aebbd777c 100644
(file)
--- a/
formats/ctf-text/ctf-text.c
+++ b/
formats/ctf-text/ctf-text.c
@@
-98,6
+98,8
@@
int ctf_text_write_event(struct stream_pos *ppos,
if (stream_class->event_header) {
if (pos->print_names)
fprintf(pos->fp, ", stream.event.header =");
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)
fprintf(pos->fp, " ");
ret = generic_rw(ppos, &stream_class->event_header->p);
if (ret)
@@
-108,6
+110,8
@@
int ctf_text_write_event(struct stream_pos *ppos,
if (stream_class->event_context) {
if (pos->print_names)
fprintf(pos->fp, ", stream.event.context =");
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)
fprintf(pos->fp, " ");
ret = generic_rw(ppos, &stream_class->event_context->p);
if (ret)
@@
-118,6
+122,8
@@
int ctf_text_write_event(struct stream_pos *ppos,
if (event_class->context) {
if (pos->print_names)
fprintf(pos->fp, ", event.context =");
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)
fprintf(pos->fp, " ");
ret = generic_rw(ppos, &event_class->context->p);
if (ret)
@@
-128,6
+134,8
@@
int ctf_text_write_event(struct stream_pos *ppos,
if (event_class->fields) {
if (pos->print_names)
fprintf(pos->fp, ", event.fields =");
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)
fprintf(pos->fp, " ");
ret = generic_rw(ppos, &event_class->fields->p);
if (ret)
@@
-161,7
+169,7
@@
struct trace_descriptor *ctf_text_open_trace(const char *path, int flags)
pos->fp = fp;
pos->parent.rw_table = write_dispatch_table;
pos->parent.event_cb = ctf_text_write_event;
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:
break;
case O_RDONLY:
default:
diff --git
a/formats/ctf-text/types/array.c
b/formats/ctf-text/types/array.c
index f61693ab85b4245867ee80e62a8eb89955449c7a..aa941b5e9a3dec8c6505d8bd1105b12ed1fac99e 100644
(file)
--- a/
formats/ctf-text/types/array.c
+++ b/
formats/ctf-text/types/array.c
@@
-25,7
+25,6
@@
int ctf_text_array_write(struct stream_pos *ppos, struct definition *definition)
int ret;
if (!pos->dummy) {
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)
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (definition->index != INT_MAX)
@@
-39,7
+38,6
@@
int ctf_text_array_write(struct stream_pos *ppos, struct definition *definition)
ret = array_rw(ppos, definition);
if (!pos->dummy) {
pos->depth--;
ret = array_rw(ppos, definition);
if (!pos->dummy) {
pos->depth--;
- //print_pos_tabs(pos);
fprintf(pos->fp, " ]");
}
return ret;
fprintf(pos->fp, " ]");
}
return ret;
diff --git
a/formats/ctf-text/types/enum.c
b/formats/ctf-text/types/enum.c
index cf8cc4fa85d19364cf13e3d1bf3ec5f528ab5153..0cb902180b3254597cc1237f9fc106e45a3ef287 100644
(file)
--- a/
formats/ctf-text/types/enum.c
+++ b/
formats/ctf-text/types/enum.c
@@
-41,11
+41,9
@@
int ctf_text_enum_write(struct stream_pos *ppos, struct definition *definition)
fprintf(pos->fp, "%s = ",
g_quark_to_string(definition->name));
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);
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, " :");
qs = enum_definition->value;
@@
-61,7
+59,6
@@
int ctf_text_enum_write(struct stream_pos *ppos, struct definition *definition)
fprintf(pos->fp, "%s\n", str);
}
pos->depth--;
fprintf(pos->fp, "%s\n", str);
}
pos->depth--;
- //print_pos_tabs(pos);
fprintf(pos->fp, " )");
return ret;
}
fprintf(pos->fp, " )");
return ret;
}
diff --git
a/formats/ctf-text/types/float.c
b/formats/ctf-text/types/float.c
index d2a66d4b813b5239270f6ac17761b453a01920b2..3569fd4e23ba92f0cd4f2f02ee6298b69af9838f 100644
(file)
--- a/
formats/ctf-text/types/float.c
+++ b/
formats/ctf-text/types/float.c
@@
-29,7
+29,6
@@
int ctf_text_float_write(struct stream_pos *ppos, struct definition *definition)
if (pos->dummy)
return 0;
if (pos->dummy)
return 0;
- //print_pos_tabs(pos);
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
diff --git
a/formats/ctf-text/types/integer.c
b/formats/ctf-text/types/integer.c
index f25f4540cbc8e67348962e46a06009a657d354fd..0032e642f58ea0a39104cbfb23765e2c68296014 100644
(file)
--- a/
formats/ctf-text/types/integer.c
+++ b/
formats/ctf-text/types/integer.c
@@
-40,15
+40,9
@@
int ctf_text_integer_write(struct stream_pos *ppos, struct definition *definitio
fprintf(pos->fp, "%s = ",
g_quark_to_string(definition->name));
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 (!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;
}
return 0;
}
diff --git
a/formats/ctf-text/types/sequence.c
b/formats/ctf-text/types/sequence.c
index 70a41dc3bb9a975d39344e59e3b83fc2d1efd83a..4e9048949fc3f54a3481b8ce2dc6b989c7a85246 100644
(file)
--- a/
formats/ctf-text/types/sequence.c
+++ b/
formats/ctf-text/types/sequence.c
@@
-25,7
+25,6
@@
int ctf_text_sequence_write(struct stream_pos *ppos, struct definition *definiti
int ret;
if (!pos->dummy) {
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)
if (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (definition->index != INT_MAX)
@@
-39,7
+38,6
@@
int ctf_text_sequence_write(struct stream_pos *ppos, struct definition *definiti
ret = sequence_rw(ppos, definition);
if (!pos->dummy) {
pos->depth--;
ret = sequence_rw(ppos, definition);
if (!pos->dummy) {
pos->depth--;
- //print_pos_tabs(pos);
fprintf(pos->fp, " ]");
}
return ret;
fprintf(pos->fp, " ]");
}
return ret;
diff --git
a/formats/ctf-text/types/string.c
b/formats/ctf-text/types/string.c
index 59924dafc90d81bc6efefd24d6ef9aee94046280..3979e826407fb745d6fc0e9ac7acf856d7c9b3f0 100644
(file)
--- a/
formats/ctf-text/types/string.c
+++ b/
formats/ctf-text/types/string.c
@@
-31,7
+31,6
@@
int ctf_text_string_write(struct stream_pos *ppos,
assert(string_definition->value != NULL);
if (pos->dummy)
return 0;
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 (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
diff --git
a/formats/ctf-text/types/struct.c
b/formats/ctf-text/types/struct.c
index e8ffddc2bc362472ea3a4503e7e5d0fb5ef77552..9f63c7bd517543683d33efd4ac728c98b4c43f67 100644
(file)
--- a/
formats/ctf-text/types/struct.c
+++ b/
formats/ctf-text/types/struct.c
@@
-26,7
+26,6
@@
int ctf_text_struct_write(struct stream_pos *ppos, struct definition *definition
if (!pos->dummy) {
if (pos->depth >= 0) {
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 (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (definition->index != INT_MAX)
@@
-42,7
+41,6
@@
int ctf_text_struct_write(struct stream_pos *ppos, struct definition *definition
if (!pos->dummy) {
pos->depth--;
if (pos->depth >= 0) {
if (!pos->dummy) {
pos->depth--;
if (pos->depth >= 0) {
- //print_pos_tabs(pos);
fprintf(pos->fp, " }");
}
}
fprintf(pos->fp, " }");
}
}
diff --git
a/formats/ctf-text/types/variant.c
b/formats/ctf-text/types/variant.c
index e6abd499db9dcc0503468c60dc38f7dfd9a6d284..1787fb3e499d5c0921cc218e3dbccacf39d777e3 100644
(file)
--- a/
formats/ctf-text/types/variant.c
+++ b/
formats/ctf-text/types/variant.c
@@
-26,7
+26,6
@@
int ctf_text_variant_write(struct stream_pos *ppos, struct definition *definitio
if (!pos->dummy) {
if (pos->depth >= 0) {
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 (definition->index != 0 && definition->index != INT_MAX)
fprintf(pos->fp, ",");
if (definition->index != INT_MAX)
@@
-42,7
+41,6
@@
int ctf_text_variant_write(struct stream_pos *ppos, struct definition *definitio
if (!pos->dummy) {
pos->depth--;
if (pos->depth >= 0) {
if (!pos->dummy) {
pos->depth--;
if (pos->depth >= 0) {
- //print_pos_tabs(pos);
fprintf(pos->fp, " }");
}
}
fprintf(pos->fp, " }");
}
}
diff --git
a/include/babeltrace/babeltrace.h
b/include/babeltrace/babeltrace.h
index fe23fefd7f2730005231ced58fd43a7b59308b42..b7646a1d57320d1edd4e1863f3d243816f160a55 100644
(file)
--- a/
include/babeltrace/babeltrace.h
+++ b/
include/babeltrace/babeltrace.h
@@
-25,4
+25,6
@@
struct trace_descriptor;
int convert_trace(struct trace_descriptor *td_write,
struct trace_descriptor *td_read);
int convert_trace(struct trace_descriptor *td_write,
struct trace_descriptor *td_read);
+extern int opt_field_names;
+
#endif
#endif
This page took
0.031219 seconds
and
4
git commands to generate.