From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
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
Subject: [tip:perf/core] perf hists browser: Put hist_entry folding logic into single function
Date: Thu, 26 Jan 2017 07:26:04 -0800 [thread overview]
Message-ID: <tip-b33f922651011effafec4508474e8591569a3e98@git.kernel.org> (raw)
In-Reply-To: <1484904032-11040-2-git-send-email-jolsa@kernel.org>
Commit-ID: b33f922651011effafec4508474e8591569a3e98
Gitweb: http://git.kernel.org/tip/b33f922651011effafec4508474e8591569a3e98
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Fri, 20 Jan 2017 10:20:29 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
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 <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1484904032-11040-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
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;
}
}
next prev parent reply other threads:[~2017-01-26 15:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-20 9:20 [PATCH 0/4] perf tools: Few fixes Jiri Olsa
2017-01-20 9:20 ` [PATCH 1/4] perf hists browser: Put hist_entry folding login into single function Jiri Olsa
2017-01-26 15:26 ` tip-bot for Jiri Olsa [this message]
2017-01-20 9:20 ` [PATCH 2/4] perf hists browser: Add e/c key handlers to expand callchain for current entry Jiri Olsa
2017-01-20 16:41 ` Arnaldo Carvalho de Melo
2017-01-20 16:43 ` Arnaldo Carvalho de Melo
2017-01-23 9:01 ` Jiri Olsa
2017-01-26 15:26 ` [tip:perf/core] perf hists browser: Add e/c hotkeys to expand/collapse " tip-bot for Jiri Olsa
2017-01-20 9:20 ` [PATCH 3/4] perf c2c report: Display Total records column in offset view Jiri Olsa
2017-01-26 15:27 ` [tip:perf/core] " tip-bot for Jiri Olsa
2017-01-20 9:20 ` [PATCH 4/4] perf c2c report: Coalesce by default only by pid,iaddr Jiri Olsa
2017-01-26 15:27 ` [tip:perf/core] " tip-bot for Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-b33f922651011effafec4508474e8591569a3e98@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).