aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/callchain.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-06-30 23:35:14 -0400
committerIngo Molnar <mingo@elte.hu>2009-07-01 03:58:26 -0400
commit4424961ad6621a02c6b4c9093e801002c1bb9f65 (patch)
tree9851ec33de4b89fee395941af8fbbaab60ab2028 /tools/perf/util/callchain.c
parent9198aa77b69647d1d91207f8075763abe7dc0bf4 (diff)
perf_counter tools: Resolve symbols in callchains
This patch resolves the names, when possible, of each ip present in the callchains while using the -c option with perf report. Example: 5.40% [k] __d_lookup 5.37% perf_callchain perf_counter_overflow intel_pmu_handle_irq perf_counter_nmi_handler notifier_call_chain atomic_notifier_call_chain notify_die do_nmi nmi do_lookup __link_path_walk path_walk do_path_lookup user_path_at sys_faccessat sys_access system_call_fastpath 0x7fb609846f77 0.01% perf_callchain perf_counter_overflow intel_pmu_handle_irq perf_counter_nmi_handler notifier_call_chain atomic_notifier_call_chain notify_die do_nmi nmi do_lookup __link_path_walk path_walk do_path_lookup user_path_at sys_faccessat 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: <1246419315-9968-3-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r--tools/perf/util/callchain.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index bbf7813fefe0..6568cb198ba6 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -67,7 +67,8 @@ static struct callchain_node *create_child(struct callchain_node *parent)
67} 67}
68 68
69static void 69static void
70fill_node(struct callchain_node *node, struct ip_callchain *chain, int start) 70fill_node(struct callchain_node *node, struct ip_callchain *chain, int start,
71 struct symbol **syms)
71{ 72{
72 int i; 73 int i;
73 74
@@ -80,24 +81,26 @@ fill_node(struct callchain_node *node, struct ip_callchain *chain, int start)
80 return; 81 return;
81 } 82 }
82 call->ip = chain->ips[i]; 83 call->ip = chain->ips[i];
84 call->sym = syms[i];
83 list_add_tail(&call->list, &node->val); 85 list_add_tail(&call->list, &node->val);
84 } 86 }
85 node->val_nr = i - start; 87 node->val_nr = i - start;
86} 88}
87 89
88static void add_child(struct callchain_node *parent, struct ip_callchain *chain) 90static void add_child(struct callchain_node *parent, struct ip_callchain *chain,
91 struct symbol **syms)
89{ 92{
90 struct callchain_node *new; 93 struct callchain_node *new;
91 94
92 new = create_child(parent); 95 new = create_child(parent);
93 fill_node(new, chain, parent->val_nr); 96 fill_node(new, chain, parent->val_nr, syms);
94 97
95 new->hit = 1; 98 new->hit = 1;
96} 99}
97 100
98static void 101static void
99split_add_child(struct callchain_node *parent, struct ip_callchain *chain, 102split_add_child(struct callchain_node *parent, struct ip_callchain *chain,
100 struct callchain_list *to_split, int idx) 103 struct callchain_list *to_split, int idx, struct symbol **syms)
101{ 104{
102 struct callchain_node *new; 105 struct callchain_node *new;
103 106
@@ -109,21 +112,22 @@ split_add_child(struct callchain_node *parent, struct ip_callchain *chain,
109 parent->val_nr = idx; 112 parent->val_nr = idx;
110 113
111 /* create the new one */ 114 /* create the new one */
112 add_child(parent, chain); 115 add_child(parent, chain, syms);
113} 116}
114 117
115static int 118static int
116__append_chain(struct callchain_node *root, struct ip_callchain *chain, 119__append_chain(struct callchain_node *root, struct ip_callchain *chain,
117 int start); 120 int start, struct symbol **syms);
118 121
119static int 122static int
120__append_chain_children(struct callchain_node *root, struct ip_callchain *chain) 123__append_chain_children(struct callchain_node *root, struct ip_callchain *chain,
124 struct symbol **syms)
121{ 125{
122 struct callchain_node *rnode; 126 struct callchain_node *rnode;
123 127
124 /* lookup in childrens */ 128 /* lookup in childrens */
125 list_for_each_entry(rnode, &root->children, brothers) { 129 list_for_each_entry(rnode, &root->children, brothers) {
126 int ret = __append_chain(rnode, chain, root->val_nr); 130 int ret = __append_chain(rnode, chain, root->val_nr, syms);
127 if (!ret) 131 if (!ret)
128 return 0; 132 return 0;
129 } 133 }
@@ -132,7 +136,7 @@ __append_chain_children(struct callchain_node *root, struct ip_callchain *chain)
132 136
133static int 137static int
134__append_chain(struct callchain_node *root, struct ip_callchain *chain, 138__append_chain(struct callchain_node *root, struct ip_callchain *chain,
135 int start) 139 int start, struct symbol **syms)
136{ 140{
137 struct callchain_list *cnode; 141 struct callchain_list *cnode;
138 int i = start; 142 int i = start;
@@ -154,7 +158,7 @@ __append_chain(struct callchain_node *root, struct ip_callchain *chain,
154 158
155 /* we match only a part of the node. Split it and add the new chain */ 159 /* we match only a part of the node. Split it and add the new chain */
156 if (i < root->val_nr) { 160 if (i < root->val_nr) {
157 split_add_child(root, chain, cnode, i); 161 split_add_child(root, chain, cnode, i, syms);
158 return 0; 162 return 0;
159 } 163 }
160 164
@@ -164,11 +168,12 @@ __append_chain(struct callchain_node *root, struct ip_callchain *chain,
164 return 0; 168 return 0;
165 } 169 }
166 170
167 return __append_chain_children(root, chain); 171 return __append_chain_children(root, chain, syms);
168} 172}
169 173
170void append_chain(struct callchain_node *root, struct ip_callchain *chain) 174void append_chain(struct callchain_node *root, struct ip_callchain *chain,
175 struct symbol **syms)
171{ 176{
172 if (__append_chain_children(root, chain) == -1) 177 if (__append_chain_children(root, chain, syms) == -1)
173 add_child(root, chain); 178 add_child(root, chain, syms);
174} 179}