From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762324AbdEXHL4 (ORCPT ); Wed, 24 May 2017 03:11:56 -0400 Received: from terminus.zytor.com ([65.50.211.136]:39159 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758410AbdEXHLx (ORCPT ); Wed, 24 May 2017 03:11:53 -0400 Date: Wed, 24 May 2017 00:07:10 -0700 From: tip-bot for Namhyung Kim Message-ID: Cc: acme@redhat.com, hpa@zytor.com, jolsa@kernel.org, milian.wolff@kdab.com, mingo@kernel.org, peterz@infradead.org, yao.jin@linux.intel.com, tglx@linutronix.de, torvalds@linux-foundation.org, fweisbec@gmail.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, acme@kernel.org, jolsa@redhat.com Reply-To: linux-kernel@vger.kernel.org, namhyung@kernel.org, jolsa@redhat.com, acme@kernel.org, torvalds@linux-foundation.org, tglx@linutronix.de, yao.jin@linux.intel.com, fweisbec@gmail.com, mingo@kernel.org, peterz@infradead.org, acme@redhat.com, hpa@zytor.com, jolsa@kernel.org, milian.wolff@kdab.com In-Reply-To: <20170524062129.32529-8-namhyung@kernel.org> References: <20170524062129.32529-8-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf tools: Put caller above callee in --children mode Git-Commit-ID: 7111ffff60a68f55d864200cd6c7677319e5c242 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 7111ffff60a68f55d864200cd6c7677319e5c242 Gitweb: http://git.kernel.org/tip/7111ffff60a68f55d864200cd6c7677319e5c242 Author: Namhyung Kim AuthorDate: Wed, 24 May 2017 15:21:29 +0900 Committer: Ingo Molnar CommitDate: Wed, 24 May 2017 08:41:49 +0200 perf tools: Put caller above callee in --children mode The __hpp__sort_acc() sorts entries using callchain depth in order to put callers above in children mode. But it assumed the callchain order was callee-first. Now default (for children) is caller-first so the order of entries is reverted. For example, consider following case: $ perf report --no-children ..l # Overhead Command Shared Object Symbol # ........ ....... ................... .......................... # 99.44% a.out a.out [.] main | ---main __libc_start_main _start Then children mode should show 'start' above '__libc_start_main' since it's the caller (parent) of the __libc_start_main. But it's reversed: # Children Self Command Shared Object Symbol # ........ ........ ....... ............... ..................... # 99.61% 0.00% a.out libc-2.25.so [.] __libc_start_main 99.61% 0.00% a.out a.out [.] _start 99.54% 99.44% a.out a.out [.] main This patch fixes it. # Children Self Command Shared Object Symbol # ........ ........ ....... ............... ..................... # 99.61% 0.00% a.out a.out [.] _start 99.61% 0.00% a.out libc-2.25.so [.] __libc_start_main 99.54% 99.44% a.out a.out [.] main Signed-off-by: Namhyung Kim Acked-by: Jiri Olsa Cc: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Linus Torvalds Cc: Milian Wolff Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Yao Jin Cc: kernel-team@lge.com Link: http://lkml.kernel.org/r/20170524062129.32529-8-namhyung@kernel.org Signed-off-by: Ingo Molnar --- tools/perf/ui/hist.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 59addd5..ddb2c6f 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -210,6 +210,8 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b, return 0; ret = b->callchain->max_depth - a->callchain->max_depth; + if (callchain_param.order == ORDER_CALLER) + ret = -ret; } return ret; }