aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index bee207ce589a..3d8c52220f1f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -122,8 +122,8 @@ static void init_rem_hits(void)
122} 122}
123 123
124static size_t 124static size_t
125callchain__fprintf_graph(FILE *fp, struct callchain_node *self, 125__callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
126 u64 total_samples, int depth, int depth_mask) 126 u64 total_samples, int depth, int depth_mask)
127{ 127{
128 struct rb_node *node, *next; 128 struct rb_node *node, *next;
129 struct callchain_node *child; 129 struct callchain_node *child;
@@ -174,9 +174,9 @@ callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
174 new_total, 174 new_total,
175 cumul); 175 cumul);
176 } 176 }
177 ret += callchain__fprintf_graph(fp, child, new_total, 177 ret += __callchain__fprintf_graph(fp, child, new_total,
178 depth + 1, 178 depth + 1,
179 new_depth_mask | (1 << depth)); 179 new_depth_mask | (1 << depth));
180 node = next; 180 node = next;
181 } 181 }
182 182
@@ -197,6 +197,33 @@ callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
197} 197}
198 198
199static size_t 199static size_t
200callchain__fprintf_graph(FILE *fp, struct callchain_node *self,
201 u64 total_samples)
202{
203 struct callchain_list *chain;
204 int i = 0;
205 int ret = 0;
206
207 list_for_each_entry(chain, &self->val, list) {
208 if (chain->ip >= PERF_CONTEXT_MAX)
209 continue;
210
211 if (!i++ && sort_by_sym_first)
212 continue;
213
214 if (chain->sym)
215 ret += fprintf(fp, " %s\n", chain->sym->name);
216 else
217 ret += fprintf(fp, " %p\n",
218 (void *)(long)chain->ip);
219 }
220
221 ret += __callchain__fprintf_graph(fp, self, total_samples, 1, 1);
222
223 return ret;
224}
225
226static size_t
200callchain__fprintf_flat(FILE *fp, struct callchain_node *self, 227callchain__fprintf_flat(FILE *fp, struct callchain_node *self,
201 u64 total_samples) 228 u64 total_samples)
202{ 229{
@@ -244,8 +271,7 @@ hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
244 break; 271 break;
245 case CHAIN_GRAPH_ABS: /* Falldown */ 272 case CHAIN_GRAPH_ABS: /* Falldown */
246 case CHAIN_GRAPH_REL: 273 case CHAIN_GRAPH_REL:
247 ret += callchain__fprintf_graph(fp, chain, 274 ret += callchain__fprintf_graph(fp, chain, total_samples);
248 total_samples, 1, 1);
249 case CHAIN_NONE: 275 case CHAIN_NONE:
250 default: 276 default:
251 break; 277 break;