aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-kmem.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 5d8aeae50004..256d18fa0471 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -307,25 +307,34 @@ static void __print_result(struct rb_root *root, int n_lines, int is_caller)
307{ 307{
308 struct rb_node *next; 308 struct rb_node *next;
309 309
310 printf("\n ------------------------------------------------------------------------------\n"); 310 printf("%.78s\n", graph_dotted_line);
311 if (is_caller) 311 printf("%-28s|", is_caller ? "Callsite": "Alloc Ptr");
312 printf(" Callsite |"); 312 printf("Total_alloc/Per | Total_req/Per | Hit | Frag\n");
313 else 313 printf("%.78s\n", graph_dotted_line);
314 printf(" Alloc Ptr |");
315 printf(" Total_alloc/Per | Total_req/Per | Hit | Fragmentation\n");
316 printf(" ------------------------------------------------------------------------------\n");
317 314
318 next = rb_first(root); 315 next = rb_first(root);
319 316
320 while (next && n_lines--) { 317 while (next && n_lines--) {
321 struct alloc_stat *data; 318 struct alloc_stat *data = rb_entry(next, struct alloc_stat,
322 319 node);
323 data = rb_entry(next, struct alloc_stat, node); 320 struct symbol *sym = NULL;
321 char bf[BUFSIZ];
322 u64 addr;
323
324 if (is_caller) {
325 addr = data->call_site;
326 sym = kernel_maps__find_symbol(addr, NULL, NULL);
327 } else
328 addr = data->ptr;
329
330 if (sym != NULL)
331 snprintf(bf, sizeof(bf), "%s/%Lx", sym->name,
332 addr - sym->start);
333 else
334 snprintf(bf, sizeof(bf), "%#Lx", addr);
324 335
325 printf(" %-16p | %8llu/%-6lu | %8llu/%-6lu | %6lu | %8.3f%%\n", 336 printf("%-28s|%8llu/%-6lu |%8llu/%-6lu|%6lu|%8.3f%%\n",
326 is_caller ? (void *)(unsigned long)data->call_site : 337 bf, (unsigned long long)data->bytes_alloc,
327 (void *)(unsigned long)data->ptr,
328 (unsigned long long)data->bytes_alloc,
329 (unsigned long)data->bytes_alloc / data->hit, 338 (unsigned long)data->bytes_alloc / data->hit,
330 (unsigned long long)data->bytes_req, 339 (unsigned long long)data->bytes_req,
331 (unsigned long)data->bytes_req / data->hit, 340 (unsigned long)data->bytes_req / data->hit,