aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-07-11 11:18:37 -0400
committerIngo Molnar <mingo@elte.hu>2009-07-11 13:20:27 -0400
commite3d7e183dc276df2fcaf02af173a49ad119ba9f9 (patch)
tree02bf81e7e1f1d4b4d585544431c8d6d5cd74f7e7 /tools/perf/builtin-report.c
parenta25e46c46311316cd1b3f27f8bb036df1693c032 (diff)
perf report: Introduce -n/--show-nr-samples
[acme@doppio pahole]$ perf report -ns comm,dso,symbol -d /lib64/libc-2.10.1.so -C pahole | head -17 21.94% 32101 [.] _int_malloc 20.10% 29402 [.] __GI_strcmp 16.77% 24533 [.] __tsearch 12.61% 18450 [.] malloc_consolidate 6.42% 9394 [.] _int_free 6.28% 9191 [.] __tfind 4.56% 6678 [.] __GI___libc_free 4.46% 6520 [.] _IO_vfprintf_internal 2.59% 3786 [.] __malloc 1.17% 1716 [.] __GI_memcpy [acme@doppio pahole]$ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <1247325517-12272-5-git-send-email-acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f3422121d858..430a195b8589 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -51,6 +51,7 @@ static int verbose;
51static int modules; 51static int modules;
52 52
53static int full_paths; 53static int full_paths;
54static int show_nr_samples;
54 55
55static unsigned long page_size; 56static unsigned long page_size;
56static unsigned long mmap_window = 32; 57static unsigned long mmap_window = 32;
@@ -1024,6 +1025,13 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, u64 total_samples)
1024 else 1025 else
1025 ret = fprintf(fp, field_sep ? "%lld" : "%12lld ", self->count); 1026 ret = fprintf(fp, field_sep ? "%lld" : "%12lld ", self->count);
1026 1027
1028 if (show_nr_samples) {
1029 if (field_sep)
1030 fprintf(fp, "%c%lld", *field_sep, self->count);
1031 else
1032 fprintf(fp, "%11lld", self->count);
1033 }
1034
1027 list_for_each_entry(se, &hist_entry__sort_list, list) { 1035 list_for_each_entry(se, &hist_entry__sort_list, list) {
1028 if (se->elide) 1036 if (se->elide)
1029 continue; 1037 continue;
@@ -1361,6 +1369,12 @@ static size_t output__fprintf(FILE *fp, u64 total_samples)
1361 fprintf(fp, "#\n"); 1369 fprintf(fp, "#\n");
1362 1370
1363 fprintf(fp, "# Overhead"); 1371 fprintf(fp, "# Overhead");
1372 if (show_nr_samples) {
1373 if (field_sep)
1374 fprintf(fp, "%cSamples", *field_sep);
1375 else
1376 fputs(" Samples ", fp);
1377 }
1364 list_for_each_entry(se, &hist_entry__sort_list, list) { 1378 list_for_each_entry(se, &hist_entry__sort_list, list) {
1365 if (se->elide) 1379 if (se->elide)
1366 continue; 1380 continue;
@@ -1388,6 +1402,8 @@ static size_t output__fprintf(FILE *fp, u64 total_samples)
1388 goto print_entries; 1402 goto print_entries;
1389 1403
1390 fprintf(fp, "# ........"); 1404 fprintf(fp, "# ........");
1405 if (show_nr_samples)
1406 fprintf(fp, " ..........");
1391 list_for_each_entry(se, &hist_entry__sort_list, list) { 1407 list_for_each_entry(se, &hist_entry__sort_list, list) {
1392 unsigned int i; 1408 unsigned int i;
1393 1409
@@ -1979,6 +1995,8 @@ static const struct option options[] = {
1979 OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), 1995 OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"),
1980 OPT_BOOLEAN('m', "modules", &modules, 1996 OPT_BOOLEAN('m', "modules", &modules,
1981 "load module symbols - WARNING: use only with -k and LIVE kernel"), 1997 "load module symbols - WARNING: use only with -k and LIVE kernel"),
1998 OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples,
1999 "Show a column with the number of samples"),
1982 OPT_STRING('s', "sort", &sort_order, "key[,key2...]", 2000 OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
1983 "sort by key(s): pid, comm, dso, symbol, parent"), 2001 "sort by key(s): pid, comm, dso, symbol, parent"),
1984 OPT_BOOLEAN('P', "full-paths", &full_paths, 2002 OPT_BOOLEAN('P', "full-paths", &full_paths,