aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-18 08:32:19 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-18 08:32:19 -0400
commitb8e6d829729d1a5991a9f628205b671cac2ec06f (patch)
tree4ca09e9fc3c21b28bc9388a237fe2faa747a4449 /tools
parent9d91a6f7a489eb914c16b82d927f9d81d629c259 (diff)
perf report: Filter to parent set by default
Make it easier to use parent filtering - default to a filtered output. Also add the parent column so that we get collapsing but dont display it by default. add --no-exclude-other to override this. Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Makefile2
-rw-r--r--tools/perf/builtin-report.c30
2 files changed, 28 insertions, 4 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 714db7327b94..672c5f069c6e 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -164,7 +164,7 @@ endif
164 164
165# CFLAGS and LDFLAGS are for the users to override from the command line. 165# CFLAGS and LDFLAGS are for the users to override from the command line.
166 166
167CFLAGS = $(M64) -ggdb3 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -O6 167CFLAGS = $(M64) -ggdb3 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6
168LDFLAGS = -lpthread -lrt -lelf -lm 168LDFLAGS = -lpthread -lrt -lelf -lm
169ALL_CFLAGS = $(CFLAGS) 169ALL_CFLAGS = $(CFLAGS)
170ALL_LDFLAGS = $(LDFLAGS) 170ALL_LDFLAGS = $(LDFLAGS)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index fe66895111b1..86981bd08f65 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -46,9 +46,12 @@ static int full_paths;
46static unsigned long page_size; 46static unsigned long page_size;
47static unsigned long mmap_window = 32; 47static unsigned long mmap_window = 32;
48 48
49static char *parent_pattern = "^sys_|^do_page_fault"; 49static char default_parent_pattern[] = "^sys_|^do_page_fault";
50static char *parent_pattern = default_parent_pattern;
50static regex_t parent_regex; 51static regex_t parent_regex;
51 52
53static int exclude_other = 1;
54
52struct ip_event { 55struct ip_event {
53 struct perf_event_header header; 56 struct perf_event_header header;
54 __u64 ip; 57 __u64 ip;
@@ -742,6 +745,9 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples)
742 struct sort_entry *se; 745 struct sort_entry *se;
743 size_t ret; 746 size_t ret;
744 747
748 if (exclude_other && !self->parent)
749 return 0;
750
745 if (total_samples) { 751 if (total_samples) {
746 double percent = self->count * 100.0 / total_samples; 752 double percent = self->count * 100.0 / total_samples;
747 char *color = PERF_COLOR_NORMAL; 753 char *color = PERF_COLOR_NORMAL;
@@ -764,6 +770,9 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples)
764 ret = fprintf(fp, "%12Ld ", self->count); 770 ret = fprintf(fp, "%12Ld ", self->count);
765 771
766 list_for_each_entry(se, &hist_entry__sort_list, list) { 772 list_for_each_entry(se, &hist_entry__sort_list, list) {
773 if (exclude_other && (se == &sort_parent))
774 continue;
775
767 fprintf(fp, " "); 776 fprintf(fp, " ");
768 ret += se->print(fp, self); 777 ret += se->print(fp, self);
769 } 778 }
@@ -855,6 +864,7 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
855 .ip = ip, 864 .ip = ip,
856 .level = level, 865 .level = level,
857 .count = count, 866 .count = count,
867 .parent = NULL,
858 }; 868 };
859 int cmp; 869 int cmp;
860 870
@@ -1029,14 +1039,20 @@ static size_t output__fprintf(FILE *fp, __u64 total_samples)
1029 fprintf(fp, "#\n"); 1039 fprintf(fp, "#\n");
1030 1040
1031 fprintf(fp, "# Overhead"); 1041 fprintf(fp, "# Overhead");
1032 list_for_each_entry(se, &hist_entry__sort_list, list) 1042 list_for_each_entry(se, &hist_entry__sort_list, list) {
1043 if (exclude_other && (se == &sort_parent))
1044 continue;
1033 fprintf(fp, " %s", se->header); 1045 fprintf(fp, " %s", se->header);
1046 }
1034 fprintf(fp, "\n"); 1047 fprintf(fp, "\n");
1035 1048
1036 fprintf(fp, "# ........"); 1049 fprintf(fp, "# ........");
1037 list_for_each_entry(se, &hist_entry__sort_list, list) { 1050 list_for_each_entry(se, &hist_entry__sort_list, list) {
1038 int i; 1051 int i;
1039 1052
1053 if (exclude_other && (se == &sort_parent))
1054 continue;
1055
1040 fprintf(fp, " "); 1056 fprintf(fp, " ");
1041 for (i = 0; i < strlen(se->header); i++) 1057 for (i = 0; i < strlen(se->header); i++)
1042 fprintf(fp, "."); 1058 fprintf(fp, ".");
@@ -1050,7 +1066,8 @@ static size_t output__fprintf(FILE *fp, __u64 total_samples)
1050 ret += hist_entry__fprintf(fp, pos, total_samples); 1066 ret += hist_entry__fprintf(fp, pos, total_samples);
1051 } 1067 }
1052 1068
1053 if (!strcmp(sort_order, default_sort_order)) { 1069 if (sort_order == default_sort_order &&
1070 parent_pattern == default_parent_pattern) {
1054 fprintf(fp, "#\n"); 1071 fprintf(fp, "#\n");
1055 fprintf(fp, "# (For more details, try: perf report --sort comm,dso,symbol)\n"); 1072 fprintf(fp, "# (For more details, try: perf report --sort comm,dso,symbol)\n");
1056 fprintf(fp, "#\n"); 1073 fprintf(fp, "#\n");
@@ -1508,6 +1525,8 @@ static const struct option options[] = {
1508 "Don't shorten the pathnames taking into account the cwd"), 1525 "Don't shorten the pathnames taking into account the cwd"),
1509 OPT_STRING('p', "parent", &parent_pattern, "regex", 1526 OPT_STRING('p', "parent", &parent_pattern, "regex",
1510 "regex filter to identify parent, see: '--sort parent'"), 1527 "regex filter to identify parent, see: '--sort parent'"),
1528 OPT_BOOLEAN('x', "exclude-other", &exclude_other,
1529 "Only display entries with parent-match"),
1511 OPT_END() 1530 OPT_END()
1512}; 1531};
1513 1532
@@ -1536,6 +1555,11 @@ int cmd_report(int argc, const char **argv, const char *prefix)
1536 1555
1537 setup_sorting(); 1556 setup_sorting();
1538 1557
1558 if (parent_pattern != default_parent_pattern)
1559 sort_dimension__add("parent");
1560 else
1561 exclude_other = 0;
1562
1539 /* 1563 /*
1540 * Any (unrecognized) arguments left? 1564 * Any (unrecognized) arguments left?
1541 */ 1565 */