aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/callchain.h
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-08-07 01:11:05 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-09 06:54:33 -0400
commit1953287bfe8afcbbd235bd6c42c9df06d52438dc (patch)
tree7428a4f33fe3509d7a705706df4f3c688266e19f /tools/perf/util/callchain.h
parent836179834833272f89098c6d1e1b89e8e69797c2 (diff)
perf tools: Fix call-chain cumul hit based sub-total (fractal mode)
The callchain fractal mode builds each new total hits in a new branch of profiling by using the parent's hits of the current branch plus the hits of the children. This is wrong, the total hits of a branch should be made of the sum of every children hits, we must ignore the parent hits in this scope. This patch also fixes another mistake with the hit counting. Now the rates are correct. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/callchain.h')
-rw-r--r--tools/perf/util/callchain.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 7812122bea1d..b2d128e07c88 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -21,7 +21,7 @@ struct callchain_node {
21 struct rb_root rb_root; /* sorted tree of children */ 21 struct rb_root rb_root; /* sorted tree of children */
22 unsigned int val_nr; 22 unsigned int val_nr;
23 u64 hit; 23 u64 hit;
24 u64 cumul_hit; /* hit + hits of children */ 24 u64 children_hit;
25}; 25};
26 26
27struct callchain_param; 27struct callchain_param;
@@ -48,6 +48,11 @@ static inline void callchain_init(struct callchain_node *node)
48 INIT_LIST_HEAD(&node->val); 48 INIT_LIST_HEAD(&node->val);
49} 49}
50 50
51static inline u64 cumul_hits(struct callchain_node *node)
52{
53 return node->hit + node->children_hit;
54}
55
51int register_callchain_param(struct callchain_param *param); 56int register_callchain_param(struct callchain_param *param);
52void append_chain(struct callchain_node *root, struct ip_callchain *chain, 57void append_chain(struct callchain_node *root, struct ip_callchain *chain,
53 struct symbol **syms); 58 struct symbol **syms);