Commit 5d8200ae authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

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: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarPekka 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4251446d
...@@ -248,6 +248,8 @@ static void he_stat__decay(struct he_stat *he_stat) ...@@ -248,6 +248,8 @@ static void he_stat__decay(struct he_stat *he_stat)
/* XXX need decay for weight too? */ /* 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) static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
{ {
u64 prev_period = he->stat.period; u64 prev_period = he->stat.period;
...@@ -263,21 +265,45 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he) ...@@ -263,21 +265,45 @@ static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
diff = prev_period - he->stat.period; diff = prev_period - he->stat.period;
if (!he->depth) {
hists->stats.total_period -= diff; hists->stats.total_period -= diff;
if (!he->filtered) if (!he->filtered)
hists->stats.total_non_filtered_period -= diff; 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; return he->stat.period == 0;
} }
static void hists__delete_entry(struct hists *hists, struct hist_entry *he) 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 (he->parent_he) {
root_in = &he->parent_he->hroot_in;
root_out = &he->parent_he->hroot_out;
} else {
if (sort__need_collapse) if (sort__need_collapse)
rb_erase(&he->rb_node_in, &hists->entries_collapsed); root_in = &hists->entries_collapsed;
else else
rb_erase(&he->rb_node_in, hists->entries_in); 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; --hists->nr_entries;
if (!he->filtered) if (!he->filtered)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment