aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-kmem.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-23 14:51:09 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-23 15:55:20 -0500
commit1b145ae58035f30353d78d25bea665091df9b438 (patch)
tree78cf5fcdbb98d2e0d15a0499246e0d065614a586 /tools/perf/builtin-kmem.c
parent2890284bcf5c13c10fae8a0c20ad2f575118a092 (diff)
perf kmem: Resolve symbols
E.g.: [root@doppio linux-2.6-tip]# perf kmem record sleep 3s [ perf record: Woken up 2 times to write data ] [ perf record: Captured and wrote 0.804 MB perf.data (~35105 samples) ] [root@doppio linux-2.6-tip]# perf kmem --stat caller | head -10 ------------------------------------------------------------------------------ Callsite |Total_alloc/Per | Total_req/Per | Hit | Frag ------------------------------------------------------------------------------ getname/40 | 1519616/4096 | 1519616/4096 | 371| 0.000% seq_read/a2 | 987136/4096 | 987136/4096 | 241| 0.000% __netdev_alloc_skb/43 | 260368/1049 | 259968/1048 | 248| 0.154% __alloc_skb/5a | 77312/256 | 77312/256 | 302| 0.000% proc_alloc_inode/33 | 76480/632 | 76472/632 | 121| 0.010% get_empty_filp/8d | 70272/192 | 70272/192 | 366| 0.000% split_vma/8e | 42064/176 | 42064/176 | 239| 0.000% [root@doppio linux-2.6-tip]# Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Acked-by: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: linux-mm@kvack.org <linux-mm@kvack.org> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <1259005869-13487-2-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-kmem.c')
-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,