Change default printout to add host, process names and vpid
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 27 Aug 2012 01:15:32 +0000 (21:15 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 27 Aug 2012 01:20:36 +0000 (21:20 -0400)
Showing the hostname:procname:vpid is a very useful default behavior.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: David Goulet <david.goulet@efficios.com>
Acked-by: Julien Desfossez <jdesfossez@efficios.com>
converter/babeltrace.c
formats/ctf-text/ctf-text.c
include/babeltrace/babeltrace-internal.h

index a6020737f8094f6c0dd158ab4ca2b0b64139eb4b..b8caa6a0bba2c55b8f312d38eaa282d1e4cc508a 100644 (file)
@@ -135,6 +135,7 @@ static void usage(FILE *fp)
        fprintf(fp, "  -f, --fields name1<,name2,...> Print additional fields:\n");
        fprintf(fp, "                                     all, trace, trace:hostname, trace:domain,\n");
        fprintf(fp, "                                     trace:procname, trace:vpid, loglevel.\n");
        fprintf(fp, "  -f, --fields name1<,name2,...> Print additional fields:\n");
        fprintf(fp, "                                     all, trace, trace:hostname, trace:domain,\n");
        fprintf(fp, "                                     trace:procname, trace:vpid, loglevel.\n");
+       fprintf(fp, "                                     (default: trace:hostname,trace:procname,trace:vpid)\n");
        fprintf(fp, "      --clock-cycles             Timestamp in cycles\n");
        fprintf(fp, "      --clock-offset seconds     Clock offset in seconds\n");
        fprintf(fp, "      --clock-seconds            Print the timestamps as [sec.ns]\n");
        fprintf(fp, "      --clock-cycles             Timestamp in cycles\n");
        fprintf(fp, "      --clock-offset seconds     Clock offset in seconds\n");
        fprintf(fp, "      --clock-seconds            Print the timestamps as [sec.ns]\n");
@@ -193,18 +194,19 @@ static int get_fields_args(poptContext *pc)
        }
        str = strtok_r(strlist, ",", &strctx);
        do {
        }
        str = strtok_r(strlist, ",", &strctx);
        do {
+               opt_trace_default_fields = 0;
                if (!strcmp(str, "all"))
                        opt_all_fields = 1;
                else if (!strcmp(str, "trace"))
                        opt_trace_field = 1;
                if (!strcmp(str, "all"))
                        opt_all_fields = 1;
                else if (!strcmp(str, "trace"))
                        opt_trace_field = 1;
+               else if (!strcmp(str, "trace:hostname"))
+                       opt_trace_hostname_field = 1;
                else if (!strcmp(str, "trace:domain"))
                        opt_trace_domain_field = 1;
                else if (!strcmp(str, "trace:procname"))
                        opt_trace_procname_field = 1;
                else if (!strcmp(str, "trace:vpid"))
                        opt_trace_vpid_field = 1;
                else if (!strcmp(str, "trace:domain"))
                        opt_trace_domain_field = 1;
                else if (!strcmp(str, "trace:procname"))
                        opt_trace_procname_field = 1;
                else if (!strcmp(str, "trace:vpid"))
                        opt_trace_vpid_field = 1;
-               else if (!strcmp(str, "trace:hostname"))
-                       opt_trace_hostname_field = 1;
                else if (!strcmp(str, "loglevel"))
                        opt_loglevel_field = 1;
                else {
                else if (!strcmp(str, "loglevel"))
                        opt_loglevel_field = 1;
                else {
index d209eca23f99da6634d6c1680045d8a3bd14f79b..7211c97f955889a4d6c15e409f2df0a87b4ae275 100644 (file)
@@ -47,6 +47,7 @@ int opt_all_field_names,
        opt_trace_procname_field,
        opt_trace_vpid_field,
        opt_trace_hostname_field,
        opt_trace_procname_field,
        opt_trace_vpid_field,
        opt_trace_hostname_field,
+       opt_trace_default_fields = 1,
        opt_loglevel_field,
        opt_delta_field = 1;
 
        opt_loglevel_field,
        opt_delta_field = 1;
 
@@ -323,7 +324,8 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition *
                else
                        fprintf(pos->fp, " ");
        }
                else
                        fprintf(pos->fp, " ");
        }
-       if ((opt_trace_hostname_field && !opt_all_fields) && stream_class->trace->env.hostname[0] != '\0') {
+       if ((opt_trace_hostname_field || opt_all_fields || opt_trace_default_fields)
+                       && stream_class->trace->env.hostname[0] != '\0') {
                set_field_names_print(pos, ITEM_HEADER);
                if (pos->print_names) {
                        fprintf(pos->fp, "trace:hostname = ");
                set_field_names_print(pos, ITEM_HEADER);
                if (pos->print_names) {
                        fprintf(pos->fp, "trace:hostname = ");
@@ -333,7 +335,7 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition *
                        fprintf(pos->fp, ", ");
                dom_print = 1;
        }
                        fprintf(pos->fp, ", ");
                dom_print = 1;
        }
-       if ((opt_trace_domain_field && !opt_all_fields) && stream_class->trace->env.domain[0] != '\0') {
+       if ((opt_trace_domain_field || opt_all_fields) && stream_class->trace->env.domain[0] != '\0') {
                set_field_names_print(pos, ITEM_HEADER);
                if (pos->print_names) {
                        fprintf(pos->fp, "trace:domain = ");
                set_field_names_print(pos, ITEM_HEADER);
                if (pos->print_names) {
                        fprintf(pos->fp, "trace:domain = ");
@@ -343,7 +345,8 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition *
                        fprintf(pos->fp, ", ");
                dom_print = 1;
        }
                        fprintf(pos->fp, ", ");
                dom_print = 1;
        }
-       if ((opt_trace_procname_field && !opt_all_fields) && stream_class->trace->env.procname[0] != '\0') {
+       if ((opt_trace_procname_field || opt_all_fields || opt_trace_default_fields)
+                       && stream_class->trace->env.procname[0] != '\0') {
                set_field_names_print(pos, ITEM_HEADER);
                if (pos->print_names) {
                        fprintf(pos->fp, "trace:procname = ");
                set_field_names_print(pos, ITEM_HEADER);
                if (pos->print_names) {
                        fprintf(pos->fp, "trace:procname = ");
@@ -355,7 +358,8 @@ int ctf_text_write_event(struct stream_pos *ppos, struct ctf_stream_definition *
                        fprintf(pos->fp, ", ");
                dom_print = 1;
        }
                        fprintf(pos->fp, ", ");
                dom_print = 1;
        }
-       if ((opt_trace_vpid_field && !opt_all_fields) && stream_class->trace->env.vpid != -1) {
+       if ((opt_trace_vpid_field || opt_all_fields || opt_trace_default_fields)
+                       && stream_class->trace->env.vpid != -1) {
                set_field_names_print(pos, ITEM_HEADER);
                if (pos->print_names) {
                        fprintf(pos->fp, "trace:vpid = ");
                set_field_names_print(pos, ITEM_HEADER);
                if (pos->print_names) {
                        fprintf(pos->fp, "trace:vpid = ");
index 92e2f5123809a86b11fe2dfb4752dea24d7f01dd..9f14177dc1431f8e519dd41b26063751f2bf7828 100644 (file)
@@ -60,6 +60,7 @@ extern int opt_all_field_names,
        opt_trace_procname_field,
        opt_trace_vpid_field,
        opt_trace_hostname_field,
        opt_trace_procname_field,
        opt_trace_vpid_field,
        opt_trace_hostname_field,
+       opt_trace_default_fields,
        opt_loglevel_field,
        opt_delta_field,
        opt_clock_cycles,
        opt_loglevel_field,
        opt_delta_field,
        opt_clock_cycles,
This page took 0.036842 seconds and 4 git commands to generate.