Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756713Ab1F1HlO (ORCPT ); Tue, 28 Jun 2011 03:41:14 -0400 Received: from mail4.hitachi.co.jp ([133.145.228.5]:53159 "EHLO mail4.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756149Ab1F1HjY (ORCPT ); Tue, 28 Jun 2011 03:39:24 -0400 X-AuditID: b753bd60-a46c9ba000003bac-89-4e098529b9bd X-AuditID: b753bd60-a46c9ba000003bac-89-4e098529b9bd From: Akihiro Nagai Subject: [PATCH -tip 0/4] perf script: add BTS analysis features To: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Frederic Weisbecker , David Ahern Cc: linux-kernel@vger.kernel.org, Masami Hiramatsu , pp-manager@sdl.hitachi.co.jp Date: Tue, 28 Jun 2011 16:40:19 +0900 Message-ID: <20110628074019.4269.32109.stgit@linux3> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4184 Lines: 87 Hi Frederic, David, This patch series adds the functions to analyze BTS logs to perf-script and, makes perf-script more informative. The patches add the following functions. - Resolve DSOs and symbols for BTS's branch_from addresses - Resolve DSOs and symbols for user-space address - Show the offset of symbols with '--show-symbol-offset' option. - Resolve the real path of [kernel.kallsym] using '--show-kernel-path' option. Usage: First, we get the BTS log with the following command. # perf record -e branches:u -c 1 -d Second, analyze it. # perf script -f ip,addr,sym,dso [--show-symbol-offset] [--show-kernel-path] This command's output format is: Output sample: # perf record -e branches:u -c 1 -d ls [snip] # perf script -f ip,addr,sym,dso --show-symbol-offset --show-kernel-path 301ec016b0 (/lib/modules/3.0.0-rc3-tip+/build/vmlinux) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc3-tip+/build/vmlinux) 301ec016b0 _start+0x0 (/lib64/ld-2.14.so) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc3-tip+/build/vmlinux) 301ec04b70 _dl_start+0x0 (/lib64/ld-2.14.so) 301ec016b3 _start+0x3 (/lib64/ld-2.14.so) 301ec04b70 _dl_start+0x0 (/lib64/ld-2.14.so) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc3-tip+/build/vmlinux) 301ec04b96 _dl_start+0x26 (/lib64/ld-2.14.so) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc3-tip+/build/vmlinux) 301ec04b9d _dl_start+0x2d (/lib64/ld-2.14.so) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc3-tip+/build/vmlinux) 301ec04c0d _dl_start+0x9d (/lib64/ld-2.14.so) 301ec04beb _dl_start+0x7b (/lib64/ld-2.14.so) [snip] 401fd0 main+0x0 (/root/bin/ls) 301f021399 __libc_start_main+0xe9 (/lib64/libc-2.14.so) 409ad0 set_program_name+0x0 (/root/bin/ls) 401ff3 main+0x23 (/root/bin/ls) 409ad0 set_program_name+0x0 (/root/bin/ls) ffffffff81467612 irq_return+0x0 (/lib/modules/3.0.0-rc3-tip+/build/vmlinux) 401ca8 strrchr@plt+0x0 (/root/bin/ls) 409ade set_program_name+0xe (/root/bin/ls) 401cae strrchr@plt+0x6 (/root/bin/ls) 401ca8 strrchr@plt+0x0 (/root/bin/ls) 401a38 _init+0x18 (/root/bin/ls) 401cb3 strrchr@plt+0xb (/root/bin/ls) 301ec13840 _dl_runtime_resolve+0x0 (/lib64/ld-2.14.so) 401a3e _init+0x1e (/root/bin/ls) 301ec0d6a0 _dl_fixup+0x0 (/lib64/ld-2.14.so) 301ec13870 _dl_runtime_resolve+0x30 (/lib64/ld-2.14.so) [snip] TODO: - add source code path field, line number field ...etc. - add record/report script to use easily and, show human-friendly output. - filtering kernel functions using scripts BTW, I couldn't run a script generated by 'perf script -g {pyton|perl}' with branch events. How do I make scripts analyzing branch events? # perf record -e branches:u -c 1 -d ls # perf script -g python # perf script -s perf-script.py in trace_begin Fatal: no event_list! # perf script -g perl # perf script -s perf-script.pl Fatal: no event_list! Thanks, --- Akihiro Nagai (4): perf script: add option resolving vmlinux path perf script: add the option to show the offset of symbols perf script: print DSOs and symbols for BTS branch_from addr perf script: resolve DSOs and symbols for user-space tools/perf/Documentation/perf-script.txt | 6 ++++ tools/perf/builtin-script.c | 44 +++++++++++++++++++----------- tools/perf/util/event.c | 4 +++ tools/perf/util/session.c | 44 ++++++++++++++---------------- tools/perf/util/session.h | 3 +- tools/perf/util/symbol.c | 12 ++++++++ tools/perf/util/symbol.h | 2 + 7 files changed, 74 insertions(+), 41 deletions(-) -- Akihiro Nagai (akihiro.nagai.hw@hitachi.com) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/