aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2015-03-23 02:30:40 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-03-24 11:07:06 -0400
commit77cfe388767572586b7d4fd533c38f902d020f17 (patch)
tree4c784994476f5e03775a3d63a373458b06546fe0 /tools
parent929a6bb71aa5ae6cb15b4b42ab7ac183ee286a1a (diff)
perf kmem: Print big numbers using thousands' group
Like perf stat, this makes easy to read the numbers on stat like below: # perf kmem stat SUMMARY ======= Total bytes requested: 9,770,900 Total bytes allocated: 9,782,712 Total bytes wasted on internal fragmentation: 11,812 Internal fragmentation: 0.120744% Cross CPU allocations: 74/152,819 Suggested-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Joonsoo Kim <js1304@gmail.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1427092244-22764-2-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-kmem.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 8c85aeb3327a..64d3623d45a0 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/rbtree.h> 21#include <linux/rbtree.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <locale.h>
23 24
24struct alloc_stat; 25struct alloc_stat;
25typedef int (*sort_fn_t)(struct alloc_stat *, struct alloc_stat *); 26typedef int (*sort_fn_t)(struct alloc_stat *, struct alloc_stat *);
@@ -325,13 +326,13 @@ static void __print_result(struct rb_root *root, struct perf_session *session,
325static void print_summary(void) 326static void print_summary(void)
326{ 327{
327 printf("\nSUMMARY\n=======\n"); 328 printf("\nSUMMARY\n=======\n");
328 printf("Total bytes requested: %lu\n", total_requested); 329 printf("Total bytes requested: %'lu\n", total_requested);
329 printf("Total bytes allocated: %lu\n", total_allocated); 330 printf("Total bytes allocated: %'lu\n", total_allocated);
330 printf("Total bytes wasted on internal fragmentation: %lu\n", 331 printf("Total bytes wasted on internal fragmentation: %'lu\n",
331 total_allocated - total_requested); 332 total_allocated - total_requested);
332 printf("Internal fragmentation: %f%%\n", 333 printf("Internal fragmentation: %f%%\n",
333 fragmentation(total_requested, total_allocated)); 334 fragmentation(total_requested, total_allocated));
334 printf("Cross CPU allocations: %lu/%lu\n", nr_cross_allocs, nr_allocs); 335 printf("Cross CPU allocations: %'lu/%'lu\n", nr_cross_allocs, nr_allocs);
335} 336}
336 337
337static void print_result(struct perf_session *session) 338static void print_result(struct perf_session *session)
@@ -706,6 +707,8 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
706 symbol__init(&session->header.env); 707 symbol__init(&session->header.env);
707 708
708 if (!strcmp(argv[0], "stat")) { 709 if (!strcmp(argv[0], "stat")) {
710 setlocale(LC_ALL, "");
711
709 if (cpu__setup_cpunode_map()) 712 if (cpu__setup_cpunode_map())
710 goto out_delete; 713 goto out_delete;
711 714