perf evsel: Add option to print stack trace on single line
authorDavid Ahern <dsahern@gmail.com>
Thu, 8 Aug 2013 02:50:52 +0000 (22:50 -0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 12 Aug 2013 13:31:08 +0000 (10:31 -0300)
Option is used by upcoming timehist command.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1375930261-77273-11-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/session.c
tools/perf/util/session.h

index e5fd65802eda728063f6b8b43e9b64accece7bf2..0d895e7040e4d398a6fd230a2e00bcfcb31fb003 100644 (file)
@@ -1497,6 +1497,8 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
        int print_sym = print_opts & PRINT_IP_OPT_SYM;
        int print_dso = print_opts & PRINT_IP_OPT_DSO;
        int print_symoffset = print_opts & PRINT_IP_OPT_SYMOFFSET;
+       int print_oneline = print_opts & PRINT_IP_OPT_ONELINE;
+       char s = print_oneline ? ' ' : '\t';
 
        if (perf_event__preprocess_sample(event, machine, &al, sample,
                                          NULL) < 0) {
@@ -1521,7 +1523,7 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
                                break;
 
                        if (print_ip)
-                               printf("%16" PRIx64, node->ip);
+                               printf("%c%16" PRIx64, s, node->ip);
 
                        if (print_sym) {
                                printf(" ");
@@ -1537,7 +1539,9 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
                                map__fprintf_dsoname(node->map, stdout);
                                printf(")");
                        }
-                       printf("\n");
+
+                       if (!print_oneline)
+                               printf("\n");
 
                        callchain_cursor_advance(&callchain_cursor);
                }
index 69e554a29c139d7a0d903043bd3a4442ea0aa3f7..7c00ccb1173e2f8ee72e3ac89eea5326d461cac4 100644 (file)
@@ -45,6 +45,7 @@ struct perf_session {
 #define PRINT_IP_OPT_SYM               (1<<1)
 #define PRINT_IP_OPT_DSO               (1<<2)
 #define PRINT_IP_OPT_SYMOFFSET (1<<3)
+#define PRINT_IP_OPT_ONELINE   (1<<4)
 
 struct perf_tool;