aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/util/callchain.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index c9900fe6b8b4..5d244afb7cdf 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -74,13 +74,11 @@ static void __sort_chain_graph(struct callchain_node *node, u64 min_hit)
74 struct callchain_node *child; 74 struct callchain_node *child;
75 75
76 node->rb_root = RB_ROOT; 76 node->rb_root = RB_ROOT;
77 node->cumul_hit = node->hit;
78 77
79 chain_for_each_child(child, node) { 78 chain_for_each_child(child, node) {
80 __sort_chain_graph(child, min_hit); 79 __sort_chain_graph(child, min_hit);
81 if (child->cumul_hit >= min_hit) 80 if (child->cumul_hit >= min_hit)
82 rb_insert_callchain(&node->rb_root, child, GRAPH); 81 rb_insert_callchain(&node->rb_root, child, GRAPH);
83 node->cumul_hit += child->cumul_hit;
84 } 82 }
85} 83}
86 84
@@ -159,7 +157,7 @@ add_child(struct callchain_node *parent, struct ip_callchain *chain,
159 new = create_child(parent, false); 157 new = create_child(parent, false);
160 fill_node(new, chain, start, syms); 158 fill_node(new, chain, start, syms);
161 159
162 new->hit = 1; 160 new->cumul_hit = new->hit = 1;
163} 161}
164 162
165/* 163/*
@@ -189,6 +187,7 @@ split_add_child(struct callchain_node *parent, struct ip_callchain *chain,
189 187
190 /* split the hits */ 188 /* split the hits */
191 new->hit = parent->hit; 189 new->hit = parent->hit;
190 new->cumul_hit = parent->cumul_hit;
192 new->val_nr = parent->val_nr - idx_local; 191 new->val_nr = parent->val_nr - idx_local;
193 parent->val_nr = idx_local; 192 parent->val_nr = idx_local;
194 193
@@ -216,10 +215,13 @@ __append_chain_children(struct callchain_node *root, struct ip_callchain *chain,
216 unsigned int ret = __append_chain(rnode, chain, start, syms); 215 unsigned int ret = __append_chain(rnode, chain, start, syms);
217 216
218 if (!ret) 217 if (!ret)
219 return; 218 goto cumul;
220 } 219 }
221 /* nothing in children, add to the current node */ 220 /* nothing in children, add to the current node */
222 add_child(root, chain, start, syms); 221 add_child(root, chain, start, syms);
222
223cumul:
224 root->cumul_hit++;
223} 225}
224 226
225static int 227static int
@@ -261,6 +263,8 @@ __append_chain(struct callchain_node *root, struct ip_callchain *chain,
261 /* we match 100% of the path, increment the hit */ 263 /* we match 100% of the path, increment the hit */
262 if (i - start == root->val_nr && i == chain->nr) { 264 if (i - start == root->val_nr && i == chain->nr) {
263 root->hit++; 265 root->hit++;
266 root->cumul_hit++;
267
264 return 0; 268 return 0;
265 } 269 }
266 270