summaryrefslogtreecommitdiff
path: root/tools/perf/util/callchain.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-01-05 03:06:00 (GMT)
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-01-08 15:37:51 (GMT)
commit42b276a2351517409d55b1202a1fa8b05c0cdc99 (patch)
tree8b8a8345d15e4dacf8c7ad3cf928941602ff493f /tools/perf/util/callchain.c
parent915b0882c3108a21e9b3b5e176d3151ad522242d (diff)
downloadlinux-42b276a2351517409d55b1202a1fa8b05c0cdc99.tar.xz
perf top: Decay periods in callchains
It missed to decay periods in callchains when decaying hist entries. This resulted in more than 100 percent overhead in callchains in the fractal style output. Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1451963160-17196-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r--tools/perf/util/callchain.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 564377d..53c43eb 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -925,6 +925,34 @@ void free_callchain(struct callchain_root *root)
free_callchain_node(&root->node);
}
+static u64 decay_callchain_node(struct callchain_node *node)
+{
+ struct callchain_node *child;
+ struct rb_node *n;
+ u64 child_hits = 0;
+
+ n = rb_first(&node->rb_root_in);
+ while (n) {
+ child = container_of(n, struct callchain_node, rb_node_in);
+
+ child_hits += decay_callchain_node(child);
+ n = rb_next(n);
+ }
+
+ node->hit = (node->hit * 7) / 8;
+ node->children_hit = child_hits;
+
+ return node->hit;
+}
+
+void decay_callchain(struct callchain_root *root)
+{
+ if (!symbol_conf.use_callchain)
+ return;
+
+ decay_callchain_node(&root->node);
+}
+
int callchain_node__make_parent_list(struct callchain_node *node)
{
struct callchain_node *parent = node->parent;