perf evsel: Allow passing a left alignment when printing a symbol
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 11 Apr 2016 13:53:51 +0000 (10:53 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 12 Apr 2016 01:18:15 +0000 (22:18 -0300)
For callchains, etc where we want it to align just below the syscall
name, for instance, in 'perf trace'

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-uk9ekchd67651c625ltaur5y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-script.c
tools/perf/util/session.c
tools/perf/util/session.h

index dbf208f0cdc2fa8ef453cb5a87c3e8e420670bc9..60fde9f5025c16c02a903603c906cd8589df2325 100644 (file)
@@ -579,7 +579,7 @@ static void print_sample_bts(struct perf_sample *sample,
                                print_opts &= ~PRINT_IP_OPT_SRCLINE;
                        }
                }
-               perf_evsel__print_ip(evsel, sample, al, print_opts,
+               perf_evsel__print_ip(evsel, sample, al, 0, print_opts,
                                     scripting_max_stack, stdout);
        }
 
@@ -788,7 +788,7 @@ static void process_event(struct perf_script *script,
                else
                        printf("\n");
 
-               perf_evsel__print_ip(evsel, sample, al,
+               perf_evsel__print_ip(evsel, sample, al, 0,
                                     output[attr->type].print_ip_opts,
                                     scripting_max_stack, stdout);
        }
index bbac0efbc10c8ae223e4948240d18cf72d0621ff..62b6d4051b99c1e5c6e9fd4a6061116f9951cc50 100644 (file)
@@ -1954,7 +1954,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
 }
 
 void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
-                         struct addr_location *al,
+                         struct addr_location *al, int left_alignment,
                          unsigned int print_opts, unsigned int stack_depth,
                          FILE *fp)
 {
@@ -1992,6 +1992,8 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
                        if (node->sym && node->sym->ignore)
                                goto next;
 
+                       fprintf(fp, "%-*.*s", left_alignment, left_alignment, " ");
+
                        if (print_ip)
                                fprintf(fp, "%c%16" PRIx64, s, node->ip);
 
@@ -2032,6 +2034,8 @@ next:
                if (al->sym && al->sym->ignore)
                        return;
 
+               fprintf(fp, "%-*.*s", left_alignment, left_alignment, " ");
+
                if (print_ip)
                        fprintf(fp, "%16" PRIx64, sample->ip);
 
index 0ee3d9dbc099920bf2b2ea865cc13610614cefeb..a6bc4ddbae3e82945f120fd312f9823e290ef34a 100644 (file)
@@ -105,7 +105,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
                                            unsigned int type);
 
 void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
-                         struct addr_location *al,
+                         struct addr_location *al, int left_alignment,
                          unsigned int print_opts, unsigned int stack_depth,
                          FILE *fp);
 
This page took 0.036047 seconds and 5 git commands to generate.