From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756031AbcK2G5H (ORCPT ); Tue, 29 Nov 2016 01:57:07 -0500 Received: from mga09.intel.com ([134.134.136.24]:21845 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755340AbcK2G47 (ORCPT ); Tue, 29 Nov 2016 01:56:59 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,715,1473145200"; d="scan'208";a="36784759" From: Jin Yao To: acme@kernel.org, jolsa@kernel.org Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@linux.intel.com Subject: [PATCH v1 0/4] perf report: Show inline stack Date: Tue, 29 Nov 2016 22:55:40 +0800 Message-Id: <1480431344-1644-1-git-send-email-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 (4): perf report: Find the inline stack for a given address perf report: Create a new option "--inline" 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 | 98 ++++++++++++++- tools/perf/ui/stdio/hist.c | 56 ++++++++- tools/perf/util/hist.c | 5 + tools/perf/util/sort.h | 1 + tools/perf/util/srcline.c | 206 ++++++++++++++++++++++++++----- tools/perf/util/symbol.h | 3 +- tools/perf/util/util.h | 15 +++ 9 files changed, 356 insertions(+), 34 deletions(-) -- 2.7.4