From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, jolsa@kernel.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, penberg@kernel.org,
eranian@google.com, acme@redhat.com, wangnan0@huawei.com,
andi@firstfloor.org, peterz@infradead.org, hpa@zytor.com,
dsahern@gmail.com, tglx@linutronix.de
Subject: [tip:perf/core] perf hists: Support decaying in hierarchy mode
Date: Wed, 24 Feb 2016 23:46:02 -0800 [thread overview]
Message-ID: <tip-5d8200ae67724960f7761b3a2216a1ca651fcc65@git.kernel.org> (raw)
In-Reply-To: <1456326830-30456-18-git-send-email-namhyung@kernel.org>
Commit-ID: 5d8200ae67724960f7761b3a2216a1ca651fcc65
Gitweb: http://git.kernel.org/tip/5d8200ae67724960f7761b3a2216a1ca651fcc65
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 25 Feb 2016 00:13:49 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 24 Feb 2016 20:21:15 -0300
perf hists: Support decaying in hierarchy mode
In the hierarchy mode, hist entries should decay their children too.
Also update hists__delete_entry() to be able to free child entries.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456326830-30456-18-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 42 ++++++++++++++++++++++++++++++++++--------
1 file changed, 34 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index a44bf5a..1c53042 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -248,6 +248,8 @@ static void he_stat__decay(struct he_stat *he_stat)
/* XXX need decay for weight too? */
}
+static void hists__delete_entry(struct hists *hists, struct hist_entry *he);
+
static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
{
u64 prev_period = he->stat.period;
@@ -263,21 +265,45 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
diff = prev_period - he->stat.period;
- hists->stats.total_period -= diff;
- if (!he->filtered)
- hists->stats.total_non_filtered_period -= diff;
+ if (!he->depth) {
+ hists->stats.total_period -= diff;
+ if (!he->filtered)
+ hists->stats.total_non_filtered_period -= diff;
+ }
+
+ if (!he->leaf) {
+ struct hist_entry *child;
+ struct rb_node *node = rb_first(&he->hroot_out);
+ while (node) {
+ child = rb_entry(node, struct hist_entry, rb_node);
+ node = rb_next(node);
+
+ if (hists__decay_entry(hists, child))
+ hists__delete_entry(hists, child);
+ }
+ }
return he->stat.period == 0;
}
static void hists__delete_entry(struct hists *hists, struct hist_entry *he)
{
- rb_erase(&he->rb_node, &hists->entries);
+ struct rb_root *root_in;
+ struct rb_root *root_out;
- if (sort__need_collapse)
- rb_erase(&he->rb_node_in, &hists->entries_collapsed);
- else
- rb_erase(&he->rb_node_in, hists->entries_in);
+ if (he->parent_he) {
+ root_in = &he->parent_he->hroot_in;
+ root_out = &he->parent_he->hroot_out;
+ } else {
+ if (sort__need_collapse)
+ root_in = &hists->entries_collapsed;
+ else
+ root_in = hists->entries_in;
+ root_out = &hists->entries;
+ }
+
+ rb_erase(&he->rb_node_in, root_in);
+ rb_erase(&he->rb_node, root_out);
--hists->nr_entries;
if (!he->filtered)
next prev parent reply other threads:[~2016-02-25 7:48 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 15:13 [PATCHSET 00/18] perf tools: Add support for hierachy view (v7) Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 01/18] perf tools: Add helper functions for some sort keys Namhyung Kim
2016-02-25 7:40 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 02/18] perf hists: Basic support of hierarchical report view Namhyung Kim
2016-02-25 7:41 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 03/18] perf hists: Resort hist entries with hierarchy Namhyung Kim
2016-02-25 7:41 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 04/18] perf hists: Add helper functions for hierarchy mode Namhyung Kim
2016-02-25 7:41 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 05/18] perf hists: Introduce hist_entry__filter() Namhyung Kim
2016-02-24 23:22 ` Arnaldo Carvalho de Melo
2016-02-25 2:02 ` Namhyung Kim
2016-02-25 7:42 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 06/18] perf hists: Support filtering in hierarchy mode Namhyung Kim
2016-02-25 7:42 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 07/18] perf hists: Resort after filtering hierarchy Namhyung Kim
2016-02-25 7:42 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 08/18] perf hists: Count number of sort keys Namhyung Kim
2016-02-25 7:43 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 09/18] perf ui/stdio: Implement hierarchy output mode Namhyung Kim
2016-02-25 7:43 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 10/18] perf ui/stdio: Align column header for hierarchy output Namhyung Kim
2016-02-25 7:43 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 11/18] perf hists browser: Count number of hierarchy entries Namhyung Kim
2016-02-25 7:44 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 12/18] perf hists browser: Support collapsing/expanding whole entries in hierarchy Namhyung Kim
2016-02-25 7:44 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 13/18] perf hists browser: Implement hierarchy output Namhyung Kim
2016-02-25 7:44 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 14/18] perf hists browser: Align column header in hierarchy mode Namhyung Kim
2016-02-25 7:45 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 15/18] perf ui/gtk: Implement hierarchy output mode Namhyung Kim
2016-02-25 7:45 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 16/18] perf report: Add --hierarchy option Namhyung Kim
2016-02-25 7:45 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 15:13 ` [PATCH v7 17/18] perf hists: Support decaying in hierarchy mode Namhyung Kim
2016-02-25 7:46 ` tip-bot for Namhyung Kim [this message]
2016-02-24 15:13 ` [PATCH v7 18/18] perf top: Add --hierarchy option Namhyung Kim
2016-02-25 7:46 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-24 20:06 ` [PATCHSET 00/18] perf tools: Add support for hierachy view (v7) Arnaldo Carvalho de Melo
2016-02-24 23:29 ` Arnaldo Carvalho de Melo
2016-02-25 2:14 ` Namhyung Kim
2016-02-25 1:22 ` Arnaldo Carvalho de Melo
2016-02-25 2:27 ` Namhyung Kim
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-5d8200ae67724960f7761b3a2216a1ca651fcc65@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=andi@firstfloor.org \
--cc=dsahern@gmail.com \
--cc=eranian@google.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=penberg@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=wangnan0@huawei.com \
/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