|
@@ -46,9 +46,12 @@ static int full_paths;
|
|
static unsigned long page_size;
|
|
static unsigned long page_size;
|
|
static unsigned long mmap_window = 32;
|
|
static unsigned long mmap_window = 32;
|
|
|
|
|
|
-static char *parent_pattern = "^sys_|^do_page_fault";
|
|
|
|
|
|
+static char default_parent_pattern[] = "^sys_|^do_page_fault";
|
|
|
|
+static char *parent_pattern = default_parent_pattern;
|
|
static regex_t parent_regex;
|
|
static regex_t parent_regex;
|
|
|
|
|
|
|
|
+static int exclude_other = 1;
|
|
|
|
+
|
|
struct ip_event {
|
|
struct ip_event {
|
|
struct perf_event_header header;
|
|
struct perf_event_header header;
|
|
__u64 ip;
|
|
__u64 ip;
|
|
@@ -742,6 +745,9 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples)
|
|
struct sort_entry *se;
|
|
struct sort_entry *se;
|
|
size_t ret;
|
|
size_t ret;
|
|
|
|
|
|
|
|
+ if (exclude_other && !self->parent)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
if (total_samples) {
|
|
if (total_samples) {
|
|
double percent = self->count * 100.0 / total_samples;
|
|
double percent = self->count * 100.0 / total_samples;
|
|
char *color = PERF_COLOR_NORMAL;
|
|
char *color = PERF_COLOR_NORMAL;
|
|
@@ -764,6 +770,9 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, __u64 total_samples)
|
|
ret = fprintf(fp, "%12Ld ", self->count);
|
|
ret = fprintf(fp, "%12Ld ", self->count);
|
|
|
|
|
|
list_for_each_entry(se, &hist_entry__sort_list, list) {
|
|
list_for_each_entry(se, &hist_entry__sort_list, list) {
|
|
|
|
+ if (exclude_other && (se == &sort_parent))
|
|
|
|
+ continue;
|
|
|
|
+
|
|
fprintf(fp, " ");
|
|
fprintf(fp, " ");
|
|
ret += se->print(fp, self);
|
|
ret += se->print(fp, self);
|
|
}
|
|
}
|
|
@@ -855,6 +864,7 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso,
|
|
.ip = ip,
|
|
.ip = ip,
|
|
.level = level,
|
|
.level = level,
|
|
.count = count,
|
|
.count = count,
|
|
|
|
+ .parent = NULL,
|
|
};
|
|
};
|
|
int cmp;
|
|
int cmp;
|
|
|
|
|
|
@@ -1029,14 +1039,20 @@ static size_t output__fprintf(FILE *fp, __u64 total_samples)
|
|
fprintf(fp, "#\n");
|
|
fprintf(fp, "#\n");
|
|
|
|
|
|
fprintf(fp, "# Overhead");
|
|
fprintf(fp, "# Overhead");
|
|
- list_for_each_entry(se, &hist_entry__sort_list, list)
|
|
|
|
|
|
+ list_for_each_entry(se, &hist_entry__sort_list, list) {
|
|
|
|
+ if (exclude_other && (se == &sort_parent))
|
|
|
|
+ continue;
|
|
fprintf(fp, " %s", se->header);
|
|
fprintf(fp, " %s", se->header);
|
|
|
|
+ }
|
|
fprintf(fp, "\n");
|
|
fprintf(fp, "\n");
|
|
|
|
|
|
fprintf(fp, "# ........");
|
|
fprintf(fp, "# ........");
|
|
list_for_each_entry(se, &hist_entry__sort_list, list) {
|
|
list_for_each_entry(se, &hist_entry__sort_list, list) {
|
|
int i;
|
|
int i;
|
|
|
|
|
|
|
|
+ if (exclude_other && (se == &sort_parent))
|
|
|
|
+ continue;
|
|
|
|
+
|
|
fprintf(fp, " ");
|
|
fprintf(fp, " ");
|
|
for (i = 0; i < strlen(se->header); i++)
|
|
for (i = 0; i < strlen(se->header); i++)
|
|
fprintf(fp, ".");
|
|
fprintf(fp, ".");
|
|
@@ -1050,7 +1066,8 @@ static size_t output__fprintf(FILE *fp, __u64 total_samples)
|
|
ret += hist_entry__fprintf(fp, pos, total_samples);
|
|
ret += hist_entry__fprintf(fp, pos, total_samples);
|
|
}
|
|
}
|
|
|
|
|
|
- if (!strcmp(sort_order, default_sort_order)) {
|
|
|
|
|
|
+ if (sort_order == default_sort_order &&
|
|
|
|
+ parent_pattern == default_parent_pattern) {
|
|
fprintf(fp, "#\n");
|
|
fprintf(fp, "#\n");
|
|
fprintf(fp, "# (For more details, try: perf report --sort comm,dso,symbol)\n");
|
|
fprintf(fp, "# (For more details, try: perf report --sort comm,dso,symbol)\n");
|
|
fprintf(fp, "#\n");
|
|
fprintf(fp, "#\n");
|
|
@@ -1508,6 +1525,8 @@ static const struct option options[] = {
|
|
"Don't shorten the pathnames taking into account the cwd"),
|
|
"Don't shorten the pathnames taking into account the cwd"),
|
|
OPT_STRING('p', "parent", &parent_pattern, "regex",
|
|
OPT_STRING('p', "parent", &parent_pattern, "regex",
|
|
"regex filter to identify parent, see: '--sort parent'"),
|
|
"regex filter to identify parent, see: '--sort parent'"),
|
|
|
|
+ OPT_BOOLEAN('x', "exclude-other", &exclude_other,
|
|
|
|
+ "Only display entries with parent-match"),
|
|
OPT_END()
|
|
OPT_END()
|
|
};
|
|
};
|
|
|
|
|
|
@@ -1536,6 +1555,11 @@ int cmd_report(int argc, const char **argv, const char *prefix)
|
|
|
|
|
|
setup_sorting();
|
|
setup_sorting();
|
|
|
|
|
|
|
|
+ if (parent_pattern != default_parent_pattern)
|
|
|
|
+ sort_dimension__add("parent");
|
|
|
|
+ else
|
|
|
|
+ exclude_other = 0;
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Any (unrecognized) arguments left?
|
|
* Any (unrecognized) arguments left?
|
|
*/
|
|
*/
|