aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2013-12-06 02:42:57 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-12-09 12:47:15 -0500
commitcc8fae1d81648e85587f5d18b4f93e0b771fb02d (patch)
treeb7edfe77030d1fa8bc19c509a36e7a4811285ca0 /tools/perf/util/session.c
parenta4eb24a49566db77ee999b46603f602a0302f481 (diff)
perf script: Add an option to print the source line number
Add field 'srcline' that displays the source file name and line number associated with the sample ip. The information displayed is the same as from addr2line. $ perf script -f comm,tid,pid,time,ip,sym,dso,symoff,srcline grep 10701/10701 2497321.421013: ffffffff81043ffa native_write_msr_safe+0xa ([kernel.kallsyms]) /usr/src/debug/kernel-3.9.fc17/linux-3.9.10-100.fc17.x86_64/arch/x86/include/asm/msr.h:95 grep 10701/10701 2497321.421984: ffffffff8165b6b3 _raw_spin_lock+0x13 ([kernel.kallsyms]) /usr/src/debug/kernel-3.9.fc17/linux-3.9.10-100.fc17.x86_64/arch/x86/include/asm/spinlock.h:54 grep 10701/10701 2497321.421990: ffffffff810b64b3 tick_sched_timer+0x53 ([kernel.kallsyms]) /usr/src/debug/kernel-3.9.fc17/linux-3.9.10-100.fc17.x86_64/kernel/time/tick-sched.c:840 grep 10701/10701 2497321.421992: ffffffff8106f63f run_timer_softirq+0x2f ([kernel.kallsyms]) /usr/src/debug/kernel-3.9.fc17/linux-3.9.10-100.fc17.x86_64/kernel/timer.c:1372 Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1386315778-11633-3-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index c236b38ed02b..e748f29c53cf 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1497,6 +1497,7 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
1497 int print_dso = print_opts & PRINT_IP_OPT_DSO; 1497 int print_dso = print_opts & PRINT_IP_OPT_DSO;
1498 int print_symoffset = print_opts & PRINT_IP_OPT_SYMOFFSET; 1498 int print_symoffset = print_opts & PRINT_IP_OPT_SYMOFFSET;
1499 int print_oneline = print_opts & PRINT_IP_OPT_ONELINE; 1499 int print_oneline = print_opts & PRINT_IP_OPT_ONELINE;
1500 int print_srcline = print_opts & PRINT_IP_OPT_SRCLINE;
1500 char s = print_oneline ? ' ' : '\t'; 1501 char s = print_oneline ? ' ' : '\t';
1501 1502
1502 if (symbol_conf.use_callchain && sample->callchain) { 1503 if (symbol_conf.use_callchain && sample->callchain) {
@@ -1546,6 +1547,10 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
1546 printf(")"); 1547 printf(")");
1547 } 1548 }
1548 1549
1550 if (print_srcline)
1551 map__fprintf_srcline(node->map, addr, "\n ",
1552 stdout);
1553
1549 if (!print_oneline) 1554 if (!print_oneline)
1550 printf("\n"); 1555 printf("\n");
1551 1556
@@ -1575,6 +1580,9 @@ next:
1575 map__fprintf_dsoname(al->map, stdout); 1580 map__fprintf_dsoname(al->map, stdout);
1576 printf(")"); 1581 printf(")");
1577 } 1582 }
1583
1584 if (print_srcline)
1585 map__fprintf_srcline(al->map, al->addr, "\n ", stdout);
1578 } 1586 }
1579} 1587}
1580 1588