diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-11-24 00:25:48 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-24 02:49:49 -0500 |
commit | 7707b6b6f8d9188b612f9fc88c65411264b1ed57 (patch) | |
tree | f2095e162560e32a9739898ab5fcd1bd7d24f14b /tools | |
parent | ee3d250446f1c1be4eceab48f3a23794d9a6564c (diff) |
perf kmem: Add new option to show raw ip
Add option "--raw-ip" to show raw ip instead of symbols:
# ./perf kmem --stat caller --raw-ip
------------------------------------------------------------------------------
Callsite |Total_alloc/Per | Total_req/Per | Hit | Frag
------------------------------------------------------------------------------
0xc05301aa | 733184/4096 | 733184/4096 | 179| 0.000%
0xc0542ba0 | 483328/4096 | 483328/4096 | 118| 0.000%
...
Also show symbols with format sym+offset instead of sym/offset.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-mm@kvack.org <linux-mm@kvack.org>
LKML-Reference: <4B0B6E5C.4080900@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-kmem.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 256d18fa0471..1ef43c212d9a 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -32,15 +32,14 @@ sort_fn_t caller_sort_fn; | |||
32 | static int alloc_lines = -1; | 32 | static int alloc_lines = -1; |
33 | static int caller_lines = -1; | 33 | static int caller_lines = -1; |
34 | 34 | ||
35 | static bool raw_ip; | ||
36 | |||
35 | static char *cwd; | 37 | static char *cwd; |
36 | static int cwdlen; | 38 | static int cwdlen; |
37 | 39 | ||
38 | struct alloc_stat { | 40 | struct alloc_stat { |
39 | union { | 41 | union { |
40 | struct { | 42 | u64 call_site; |
41 | char *name; | ||
42 | u64 call_site; | ||
43 | }; | ||
44 | u64 ptr; | 43 | u64 ptr; |
45 | }; | 44 | }; |
46 | u64 bytes_req; | 45 | u64 bytes_req; |
@@ -323,12 +322,14 @@ static void __print_result(struct rb_root *root, int n_lines, int is_caller) | |||
323 | 322 | ||
324 | if (is_caller) { | 323 | if (is_caller) { |
325 | addr = data->call_site; | 324 | addr = data->call_site; |
326 | sym = kernel_maps__find_symbol(addr, NULL, NULL); | 325 | if (!raw_ip) |
326 | sym = kernel_maps__find_symbol(addr, | ||
327 | NULL, NULL); | ||
327 | } else | 328 | } else |
328 | addr = data->ptr; | 329 | addr = data->ptr; |
329 | 330 | ||
330 | if (sym != NULL) | 331 | if (sym != NULL) |
331 | snprintf(bf, sizeof(bf), "%s/%Lx", sym->name, | 332 | snprintf(bf, sizeof(bf), "%s+%Lx", sym->name, |
332 | addr - sym->start); | 333 | addr - sym->start); |
333 | else | 334 | else |
334 | snprintf(bf, sizeof(bf), "%#Lx", addr); | 335 | snprintf(bf, sizeof(bf), "%#Lx", addr); |
@@ -345,9 +346,9 @@ static void __print_result(struct rb_root *root, int n_lines, int is_caller) | |||
345 | } | 346 | } |
346 | 347 | ||
347 | if (n_lines == -1) | 348 | if (n_lines == -1) |
348 | printf(" ... | ... | ... | ... | ... \n"); | 349 | printf(" ... | ... | ... | ... | ... \n"); |
349 | 350 | ||
350 | printf(" ------------------------------------------------------------------------------\n"); | 351 | printf("%.78s\n", graph_dotted_line); |
351 | } | 352 | } |
352 | 353 | ||
353 | static void print_summary(void) | 354 | static void print_summary(void) |
@@ -558,6 +559,7 @@ static const struct option kmem_options[] = { | |||
558 | OPT_CALLBACK('l', "line", NULL, "num", | 559 | OPT_CALLBACK('l', "line", NULL, "num", |
559 | "show n lins", | 560 | "show n lins", |
560 | parse_line_opt), | 561 | parse_line_opt), |
562 | OPT_BOOLEAN(0, "raw-ip", &raw_ip, "show raw ip instead of symbol"), | ||
561 | OPT_END() | 563 | OPT_END() |
562 | }; | 564 | }; |
563 | 565 | ||