aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-04-11 09:53:51 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-04-11 21:18:15 -0400
commitdb3617f362d7e205621c1ccc22b77d224a81ee14 (patch)
tree6633853b60e1a2143478dd59baea4f2c00bfe1e0 /tools/perf
parent6186de9a491af030889b372193fc9f38c248e69a (diff)
perf evsel: Allow passing a left alignment when printing a symbol
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>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-script.c4
-rw-r--r--tools/perf/util/session.c6
-rw-r--r--tools/perf/util/session.h2
3 files changed, 8 insertions, 4 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index dbf208f0cdc2..60fde9f5025c 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -579,7 +579,7 @@ static void print_sample_bts(struct perf_sample *sample,
579 print_opts &= ~PRINT_IP_OPT_SRCLINE; 579 print_opts &= ~PRINT_IP_OPT_SRCLINE;
580 } 580 }
581 } 581 }
582 perf_evsel__print_ip(evsel, sample, al, print_opts, 582 perf_evsel__print_ip(evsel, sample, al, 0, print_opts,
583 scripting_max_stack, stdout); 583 scripting_max_stack, stdout);
584 } 584 }
585 585
@@ -788,7 +788,7 @@ static void process_event(struct perf_script *script,
788 else 788 else
789 printf("\n"); 789 printf("\n");
790 790
791 perf_evsel__print_ip(evsel, sample, al, 791 perf_evsel__print_ip(evsel, sample, al, 0,
792 output[attr->type].print_ip_opts, 792 output[attr->type].print_ip_opts,
793 scripting_max_stack, stdout); 793 scripting_max_stack, stdout);
794 } 794 }
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index bbac0efbc10c..62b6d4051b99 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1954,7 +1954,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
1954} 1954}
1955 1955
1956void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample, 1956void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
1957 struct addr_location *al, 1957 struct addr_location *al, int left_alignment,
1958 unsigned int print_opts, unsigned int stack_depth, 1958 unsigned int print_opts, unsigned int stack_depth,
1959 FILE *fp) 1959 FILE *fp)
1960{ 1960{
@@ -1992,6 +1992,8 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
1992 if (node->sym && node->sym->ignore) 1992 if (node->sym && node->sym->ignore)
1993 goto next; 1993 goto next;
1994 1994
1995 fprintf(fp, "%-*.*s", left_alignment, left_alignment, " ");
1996
1995 if (print_ip) 1997 if (print_ip)
1996 fprintf(fp, "%c%16" PRIx64, s, node->ip); 1998 fprintf(fp, "%c%16" PRIx64, s, node->ip);
1997 1999
@@ -2032,6 +2034,8 @@ next:
2032 if (al->sym && al->sym->ignore) 2034 if (al->sym && al->sym->ignore)
2033 return; 2035 return;
2034 2036
2037 fprintf(fp, "%-*.*s", left_alignment, left_alignment, " ");
2038
2035 if (print_ip) 2039 if (print_ip)
2036 fprintf(fp, "%16" PRIx64, sample->ip); 2040 fprintf(fp, "%16" PRIx64, sample->ip);
2037 2041
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 0ee3d9dbc099..a6bc4ddbae3e 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -105,7 +105,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
105 unsigned int type); 105 unsigned int type);
106 106
107void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample, 107void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
108 struct addr_location *al, 108 struct addr_location *al, int left_alignment,
109 unsigned int print_opts, unsigned int stack_depth, 109 unsigned int print_opts, unsigned int stack_depth,
110 FILE *fp); 110 FILE *fp);
111 111