aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-07-02 14:14:33 -0400
committerIngo Molnar <mingo@elte.hu>2009-07-02 15:38:37 -0400
commitc20ab37ef30f4a874cf27e84c12c73e584e6f5cc (patch)
tree47f4d893d09727e387ac6742cc20156302e9c3fa /tools/perf/util
parent4eb3e4788b8a5e220a0aeb590f88c28850726ebe (diff)
perf_counter tools: Set the minimum percent for callchains to be displayed
Callchains output may become a burden on a trace because even rarely hit site are exposed. This can be too much information. Let the user set a threshold as a minimum percent of hits using the new pattern for the -c option: -c mode,min_percent Example: $ perf report -s sym -c flat,4 8.25% [k] copy_user_generic_string 4.19% copy_user_generic_string generic_file_aio_read do_sync_read vfs_read sys_pread64 system_call_fastpath pread64 5.39% [k] search_by_key 4.63% 0x00000000009e0a 2.36% [k] memcpy_c [...] $ perf report -s sym -c graph,2 8.25% [k] copy_user_generic_string | |--4.31%-- generic_file_aio_read | do_sync_read | vfs_read | | | --4.19%-- sys_pread64 | system_call_fastpath | pread64 | --3.24%-- generic_file_buffered_write __generic_file_aio_write_nolock generic_file_aio_write do_sync_write reiserfs_file_write vfs_write | --3.14%-- sys_pwrite64 system_call_fastpath __pwrite64 5.39% [k] search_by_key | --2.23%-- reiserfs_update_sd_size 4.63% 0x00000000009e0a 2.36% [k] memcpy_c [...] You can also omit it and it will default to 0. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Anton Blanchard <anton@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <1246558475-10624-1-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/callchain.c19
-rw-r--r--tools/perf/util/callchain.h6
2 files changed, 15 insertions, 10 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 */
60void sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node) 60void 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
71static void __sort_chain_graph(struct callchain_node *node) 72static 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
85void 87void
86sort_chain_graph(struct rb_root *rb_root, struct callchain_node *chain_root) 88sort_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
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index dfa56008d9ad..f3e4776e7430 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -38,6 +38,8 @@ static inline void callchain_init(struct callchain_node *node)
38 38
39void append_chain(struct callchain_node *root, struct ip_callchain *chain, 39void append_chain(struct callchain_node *root, struct ip_callchain *chain,
40 struct symbol **syms); 40 struct symbol **syms);
41void sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node); 41void sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node,
42void sort_chain_graph(struct rb_root *rb_root, struct callchain_node *node); 42 u64 min_hit);
43void sort_chain_graph(struct rb_root *rb_root, struct callchain_node *node,
44 u64 min_hit);
43#endif 45#endif