diff options
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r-- | tools/perf/util/callchain.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index a9873aafcd92..c9900fe6b8b4 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -57,18 +57,19 @@ rb_insert_callchain(struct rb_root *root, struct callchain_node *chain, | |||
57 | * Once we get every callchains from the stream, we can now | 57 | * Once we get every callchains from the stream, we can now |
58 | * sort them by hit | 58 | * sort them by hit |
59 | */ | 59 | */ |
60 | void sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node) | 60 | void sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node, |
61 | u64 min_hit) | ||
61 | { | 62 | { |
62 | struct callchain_node *child; | 63 | struct callchain_node *child; |
63 | 64 | ||
64 | chain_for_each_child(child, node) | 65 | chain_for_each_child(child, node) |
65 | sort_chain_flat(rb_root, child); | 66 | sort_chain_flat(rb_root, child, min_hit); |
66 | 67 | ||
67 | if (node->hit) | 68 | if (node->hit && node->hit >= min_hit) |
68 | rb_insert_callchain(rb_root, node, FLAT); | 69 | rb_insert_callchain(rb_root, node, FLAT); |
69 | } | 70 | } |
70 | 71 | ||
71 | static void __sort_chain_graph(struct callchain_node *node) | 72 | static void __sort_chain_graph(struct callchain_node *node, u64 min_hit) |
72 | { | 73 | { |
73 | struct callchain_node *child; | 74 | struct callchain_node *child; |
74 | 75 | ||
@@ -76,16 +77,18 @@ static void __sort_chain_graph(struct callchain_node *node) | |||
76 | node->cumul_hit = node->hit; | 77 | node->cumul_hit = node->hit; |
77 | 78 | ||
78 | chain_for_each_child(child, node) { | 79 | chain_for_each_child(child, node) { |
79 | __sort_chain_graph(child); | 80 | __sort_chain_graph(child, min_hit); |
80 | rb_insert_callchain(&node->rb_root, child, GRAPH); | 81 | if (child->cumul_hit >= min_hit) |
82 | rb_insert_callchain(&node->rb_root, child, GRAPH); | ||
81 | node->cumul_hit += child->cumul_hit; | 83 | node->cumul_hit += child->cumul_hit; |
82 | } | 84 | } |
83 | } | 85 | } |
84 | 86 | ||
85 | void | 87 | void |
86 | sort_chain_graph(struct rb_root *rb_root, struct callchain_node *chain_root) | 88 | sort_chain_graph(struct rb_root *rb_root, struct callchain_node *chain_root, |
89 | u64 min_hit) | ||
87 | { | 90 | { |
88 | __sort_chain_graph(chain_root); | 91 | __sort_chain_graph(chain_root, min_hit); |
89 | rb_root->rb_node = chain_root->rb_root.rb_node; | 92 | rb_root->rb_node = chain_root->rb_root.rb_node; |
90 | } | 93 | } |
91 | 94 | ||