Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754193AbdCNBQJ (ORCPT ); Mon, 13 Mar 2017 21:16:09 -0400 Received: from mga07.intel.com ([134.134.136.100]:13456 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752781AbdCNBQH (ORCPT ); Mon, 13 Mar 2017 21:16:07 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,161,1486454400"; d="scan'208";a="67109043" Subject: Re: [PATCH v4 0/5] perf report: Show inline stack To: acme@kernel.org, jolsa@kernel.org References: <1488537785-10684-1-git-send-email-yao.jin@linux.intel.com> Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, milian.wolff@kdab.com From: "Jin, Yao" Message-ID: <0b1d1e33-a6ab-8780-7293-74e11b20d719@linux.intel.com> Date: Tue, 14 Mar 2017 09:16:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1488537785-10684-1-git-send-email-yao.jin@linux.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5100 Lines: 160 Hi, Any comments for this v4 patch series? Thanks Jin Yao On 3/3/2017 6:43 PM, Jin Yao wrote: > v4: Remove the options "--inline-line" and "--inline-name". Just use > a new option "--inline" to print the inline function information. > The policy is if the inline function name can be resolved then > print the name in priority. If the name can't be resolved, then > print the source line number. > > For example: > perf report --stdio --inline > > 0.69% 0.00% inline ld-2.23.so [.] dl_main > | > ---dl_main > | > --0.56%--_dl_relocate_object > | > ---_dl_relocate_object (inline) > elf_dynamic_do_Rela (inline) > > Following 3 patches are updated according to this change. > perf report: Show inline stack in browser mode > perf report: Show inline stack in stdio mode > perf report: Create new inline option > > Followings are not changed. > perf report: Find the inline stack for a given address > perf report: Refactor common code in srcline.c > > v3: Iterate on RIPs of all callchain entries to check if the RIP is in > inline functions. > > Reverse the order of the inliner printout if necessary. > > Provide new options "--inline-line" / "--inline-name" to print > inline function name or print inline function source line. > > v2: Thanks so much for Arnaldo's comments! > The modifications are: > > 1. Divide v1 patch "perf report: Find the inline stack for a > given address" into 2 patches: > a. perf report: Refactor common code in srcline.c > b. perf report: Find the inline stack for a given address > > Some function names are changed: > dso_name_get -> dso__name > ilist_apend -> inline_list__append > get_inline_node -> dso__parse_addr_inlines > free_inline_node -> inline_node__delete > > 2. Since the function name are changed, update following patches > accordingly. > a. perf report: Show inline stack in stdio mode > b. perf report: Show inline stack in browser mode > > 3. Rebase to latest perf/core branch. This patch is impacted. > a. perf report: Create a new option "--inline" > > v1: Initial post > > It would be useful for perf to support a mode to query the > inline stack for callgraph addresses. This would simplify > finding the right code in code that does a lot of inlining. > > For example, the c code: > > static inline void f3(void) > { > int i; > for (i = 0; i < 1000;) { > > if(i%2) > i++; > else > i++; > } > printf("hello f3\n"); /* D */ > } > > /* < CALLCHAIN: f2 <- f1 > */ > static inline void f2(void) > { > int i; > for (i = 0; i < 100; i++) { > f3(); /* C */ > } > } > > /* < CALLCHAIN: f1 <- main > */ > static inline void f1(void) > { > int i; > for (i = 0; i < 100; i++) { > f2(); /* B */ > } > } > > /* < CALLCHAIN: main <- TOP > */ > int main() > { > struct timeval tv; > time_t start, end; > > gettimeofday(&tv, NULL); > start = end = tv.tv_sec; > while((end - start) < 5) { > f1(); /* A */ > gettimeofday(&tv, NULL); > end = tv.tv_sec; > } > return 0; > } > > The printed inline stack is: > > 0.05% test2 test2 [.] main > | > ---/home/perf-dev/lck-2867/test/test2.c:27 (inline) > /home/perf-dev/lck-2867/test/test2.c:35 (inline) > /home/perf-dev/lck-2867/test/test2.c:45 (inline) > /home/perf-dev/lck-2867/test/test2.c:61 (inline) > > I tag A/B/C/D in above c code to indicate the source line, > actually the inline stack is equal to: > > 0.05% test2 test2 [.] main > | > ---D > C > B > A > > Jin Yao (5): > perf report: Refactor common code in srcline.c > perf report: Find the inline stack for a given address > perf report: Create new inline option > perf report: Show inline stack in stdio mode > perf report: Show inline stack in browser mode > > tools/perf/Documentation/perf-report.txt | 4 + > tools/perf/builtin-report.c | 2 + > tools/perf/ui/browsers/hists.c | 168 ++++++++++++++++++++-- > tools/perf/ui/stdio/hist.c | 76 +++++++++- > tools/perf/util/hist.c | 5 + > tools/perf/util/sort.h | 1 + > tools/perf/util/srcline.c | 237 +++++++++++++++++++++++++++---- > tools/perf/util/symbol-elf.c | 5 + > tools/perf/util/symbol.h | 5 +- > tools/perf/util/util.h | 16 +++ > 10 files changed, 481 insertions(+), 38 deletions(-) >