From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753539AbdAZP12 (ORCPT ); Thu, 26 Jan 2017 10:27:28 -0500 Received: from terminus.zytor.com ([65.50.211.136]:47418 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753177AbdAZP10 (ORCPT ); Thu, 26 Jan 2017 10:27:26 -0500 Date: Thu, 26 Jan 2017 07:26:04 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: hpa@zytor.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, mingo@kernel.org, tglx@linutronix.de, namhyung@kernel.org, a.p.zijlstra@chello.nl, dsahern@gmail.com, acme@redhat.com Reply-To: acme@redhat.com, tglx@linutronix.de, mingo@kernel.org, jolsa@kernel.org, namhyung@kernel.org, a.p.zijlstra@chello.nl, dsahern@gmail.com, linux-kernel@vger.kernel.org, hpa@zytor.com In-Reply-To: <1484904032-11040-2-git-send-email-jolsa@kernel.org> References: <1484904032-11040-2-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf hists browser: Put hist_entry folding logic into single function Git-Commit-ID: b33f922651011effafec4508474e8591569a3e98 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: b33f922651011effafec4508474e8591569a3e98 Gitweb: http://git.kernel.org/tip/b33f922651011effafec4508474e8591569a3e98 Author: Jiri Olsa AuthorDate: Fri, 20 Jan 2017 10:20:29 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 20 Jan 2017 10:04:45 -0300 perf hists browser: Put hist_entry folding logic into single function It will be used in following patch to expand or collapse only the current browser entry. Signed-off-by: Jiri Olsa Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1484904032-11040-2-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/browsers/hists.c | 43 ++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 641b402..8bf18af 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -501,8 +501,8 @@ static int hierarchy_set_folding(struct hist_browser *hb, struct hist_entry *he, return n; } -static void hist_entry__set_folding(struct hist_entry *he, - struct hist_browser *hb, bool unfold) +static void __hist_entry__set_folding(struct hist_entry *he, + struct hist_browser *hb, bool unfold) { hist_entry__init_have_children(he); he->unfolded = unfold ? he->has_children : false; @@ -520,12 +520,34 @@ static void hist_entry__set_folding(struct hist_entry *he, he->nr_rows = 0; } +static void hist_entry__set_folding(struct hist_entry *he, + struct hist_browser *browser, bool unfold) +{ + double percent; + + percent = hist_entry__get_percent_limit(he); + if (he->filtered || percent < browser->min_pcnt) + return; + + __hist_entry__set_folding(he, browser, unfold); + + if (!he->depth || unfold) + browser->nr_hierarchy_entries++; + if (he->leaf) + browser->nr_callchain_rows += he->nr_rows; + else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) { + browser->nr_hierarchy_entries++; + he->has_no_entry = true; + he->nr_rows = 1; + } else + he->has_no_entry = false; +} + static void __hist_browser__set_folding(struct hist_browser *browser, bool unfold) { struct rb_node *nd; struct hist_entry *he; - double percent; nd = rb_first(&browser->hists->entries); while (nd) { @@ -535,21 +557,6 @@ __hist_browser__set_folding(struct hist_browser *browser, bool unfold) nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD); hist_entry__set_folding(he, browser, unfold); - - percent = hist_entry__get_percent_limit(he); - if (he->filtered || percent < browser->min_pcnt) - continue; - - if (!he->depth || unfold) - browser->nr_hierarchy_entries++; - if (he->leaf) - browser->nr_callchain_rows += he->nr_rows; - else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) { - browser->nr_hierarchy_entries++; - he->has_no_entry = true; - he->nr_rows = 1; - } else - he->has_no_entry = false; } }