diff options
-rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | tools/perf/util/evlist.c | 17 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 5 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 4 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 19 | ||||
-rw-r--r-- | tools/perf/util/parse-events.h | 3 | ||||
-rw-r--r-- | tools/perf/util/parse-events.y | 4 | ||||
-rw-r--r-- | tools/perf/util/python.c | 2 |
10 files changed, 28 insertions, 32 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f5b6137c0f7e..c4e3b683e79b 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -193,7 +193,7 @@ static void perf_record__open(struct perf_record *rec) | |||
193 | perf_evlist__config_attrs(evlist, opts); | 193 | perf_evlist__config_attrs(evlist, opts); |
194 | 194 | ||
195 | if (opts->group) | 195 | if (opts->group) |
196 | perf_evlist__group(evlist); | 196 | perf_evlist__set_leader(evlist); |
197 | 197 | ||
198 | list_for_each_entry(pos, &evlist->entries, node) { | 198 | list_for_each_entry(pos, &evlist->entries, node) { |
199 | struct perf_event_attr *attr = &pos->attr; | 199 | struct perf_event_attr *attr = &pos->attr; |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 23908a85bba9..7b9c46341e02 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -478,7 +478,7 @@ static int run_perf_stat(int argc __used, const char **argv) | |||
478 | } | 478 | } |
479 | 479 | ||
480 | if (group) | 480 | if (group) |
481 | perf_evlist__group(evsel_list); | 481 | perf_evlist__set_leader(evsel_list); |
482 | 482 | ||
483 | first = list_entry(evsel_list->entries.next, struct perf_evsel, node); | 483 | first = list_entry(evsel_list->entries.next, struct perf_evsel, node); |
484 | 484 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 392d2192b75e..5a097beb8685 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -890,7 +890,7 @@ static void perf_top__start_counters(struct perf_top *top) | |||
890 | struct perf_evlist *evlist = top->evlist; | 890 | struct perf_evlist *evlist = top->evlist; |
891 | 891 | ||
892 | if (top->group) | 892 | if (top->group) |
893 | perf_evlist__group(evlist); | 893 | perf_evlist__set_leader(evlist); |
894 | 894 | ||
895 | list_for_each_entry(counter, &evlist->entries, node) { | 895 | list_for_each_entry(counter, &evlist->entries, node) { |
896 | struct perf_event_attr *attr = &counter->attr; | 896 | struct perf_event_attr *attr = &counter->attr; |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index feffee3f2bd8..6d09451430d2 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -108,10 +108,23 @@ void perf_evlist__splice_list_tail(struct perf_evlist *evlist, | |||
108 | evlist->nr_entries += nr_entries; | 108 | evlist->nr_entries += nr_entries; |
109 | } | 109 | } |
110 | 110 | ||
111 | void perf_evlist__group(struct perf_evlist *evlist) | 111 | void __perf_evlist__set_leader(struct list_head *list) |
112 | { | ||
113 | struct perf_evsel *evsel, *leader; | ||
114 | |||
115 | leader = list_entry(list->next, struct perf_evsel, node); | ||
116 | leader->leader = NULL; | ||
117 | |||
118 | list_for_each_entry(evsel, list, node) { | ||
119 | if (evsel != leader) | ||
120 | evsel->leader = leader; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | void perf_evlist__set_leader(struct perf_evlist *evlist) | ||
112 | { | 125 | { |
113 | if (evlist->nr_entries) | 126 | if (evlist->nr_entries) |
114 | parse_events__set_leader(&evlist->entries); | 127 | __perf_evlist__set_leader(&evlist->entries); |
115 | } | 128 | } |
116 | 129 | ||
117 | int perf_evlist__add_default(struct perf_evlist *evlist) | 130 | int perf_evlist__add_default(struct perf_evlist *evlist) |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index a19ccd7b51fa..7fe677e6c314 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -118,6 +118,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, | |||
118 | void perf_evlist__delete_maps(struct perf_evlist *evlist); | 118 | void perf_evlist__delete_maps(struct perf_evlist *evlist); |
119 | int perf_evlist__set_filters(struct perf_evlist *evlist); | 119 | int perf_evlist__set_filters(struct perf_evlist *evlist); |
120 | 120 | ||
121 | void __perf_evlist__set_leader(struct list_head *list); | ||
122 | void perf_evlist__set_leader(struct perf_evlist *evlist); | ||
123 | |||
121 | u64 perf_evlist__sample_type(const struct perf_evlist *evlist); | 124 | u64 perf_evlist__sample_type(const struct perf_evlist *evlist); |
122 | bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist); | 125 | bool perf_evlist__sample_id_all(const const struct perf_evlist *evlist); |
123 | u16 perf_evlist__id_hdr_size(const struct perf_evlist *evlist); | 126 | u16 perf_evlist__id_hdr_size(const struct perf_evlist *evlist); |
@@ -131,6 +134,4 @@ bool perf_evlist__valid_sample_id_all(const struct perf_evlist *evlist); | |||
131 | void perf_evlist__splice_list_tail(struct perf_evlist *evlist, | 134 | void perf_evlist__splice_list_tail(struct perf_evlist *evlist, |
132 | struct list_head *list, | 135 | struct list_head *list, |
133 | int nr_entries); | 136 | int nr_entries); |
134 | |||
135 | void perf_evlist__group(struct perf_evlist *evlist); | ||
136 | #endif /* __PERF_EVLIST_H */ | 137 | #endif /* __PERF_EVLIST_H */ |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index f5b68e73d751..6c7dcc1fde5a 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -622,10 +622,6 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, | |||
622 | err = -errno; | 622 | err = -errno; |
623 | goto out_close; | 623 | goto out_close; |
624 | } | 624 | } |
625 | |||
626 | pr_debug("event cpu %d, thread %d, fd %d, group %d\n", | ||
627 | cpu, pid, FD(evsel, cpu, thread), | ||
628 | group_fd); | ||
629 | } | 625 | } |
630 | } | 626 | } |
631 | 627 | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index f6453cd414ae..4393a6b65c51 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -611,31 +611,18 @@ int parse_events_add_pmu(struct list_head **list, int *idx, | |||
611 | pmu_event_name(head_config)); | 611 | pmu_event_name(head_config)); |
612 | } | 612 | } |
613 | 613 | ||
614 | struct perf_evsel *parse_events__set_leader(struct list_head *list) | ||
615 | { | ||
616 | struct perf_evsel *evsel, *leader; | ||
617 | |||
618 | leader = list_entry(list->next, struct perf_evsel, node); | ||
619 | leader->leader = NULL; | ||
620 | |||
621 | list_for_each_entry(evsel, list, node) | ||
622 | if (evsel != leader) | ||
623 | evsel->leader = leader; | ||
624 | |||
625 | return leader; | ||
626 | } | ||
627 | |||
628 | int parse_events__modifier_group(struct list_head *list, | 614 | int parse_events__modifier_group(struct list_head *list, |
629 | char *event_mod) | 615 | char *event_mod) |
630 | { | 616 | { |
631 | return parse_events__modifier_event(list, event_mod, true); | 617 | return parse_events__modifier_event(list, event_mod, true); |
632 | } | 618 | } |
633 | 619 | ||
634 | void parse_events__group(char *name, struct list_head *list) | 620 | void parse_events__set_leader(char *name, struct list_head *list) |
635 | { | 621 | { |
636 | struct perf_evsel *leader; | 622 | struct perf_evsel *leader; |
637 | 623 | ||
638 | leader = parse_events__set_leader(list); | 624 | __perf_evlist__set_leader(list); |
625 | leader = list_entry(list->next, struct perf_evsel, node); | ||
639 | leader->group_name = name ? strdup(name) : NULL; | 626 | leader->group_name = name ? strdup(name) : NULL; |
640 | } | 627 | } |
641 | 628 | ||
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index e1a184c9e358..0b9782dc3da2 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -92,8 +92,7 @@ int parse_events_add_breakpoint(struct list_head **list, int *idx, | |||
92 | void *ptr, char *type); | 92 | void *ptr, char *type); |
93 | int parse_events_add_pmu(struct list_head **list, int *idx, | 93 | int parse_events_add_pmu(struct list_head **list, int *idx, |
94 | char *pmu , struct list_head *head_config); | 94 | char *pmu , struct list_head *head_config); |
95 | struct perf_evsel *parse_events__set_leader(struct list_head *list); | 95 | void parse_events__set_leader(char *name, struct list_head *list); |
96 | void parse_events__group(char *name, struct list_head *list); | ||
97 | void parse_events_update_lists(struct list_head *list_event, | 96 | void parse_events_update_lists(struct list_head *list_event, |
98 | struct list_head *list_all); | 97 | struct list_head *list_all); |
99 | void parse_events_error(void *data, void *scanner, char const *msg); | 98 | void parse_events_error(void *data, void *scanner, char const *msg); |
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 084c35fc2d26..66850f820df9 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y | |||
@@ -119,7 +119,7 @@ PE_NAME '{' events '}' | |||
119 | { | 119 | { |
120 | struct list_head *list = $3; | 120 | struct list_head *list = $3; |
121 | 121 | ||
122 | parse_events__group($1, list); | 122 | parse_events__set_leader($1, list); |
123 | $$ = list; | 123 | $$ = list; |
124 | } | 124 | } |
125 | | | 125 | | |
@@ -127,7 +127,7 @@ PE_NAME '{' events '}' | |||
127 | { | 127 | { |
128 | struct list_head *list = $2; | 128 | struct list_head *list = $2; |
129 | 129 | ||
130 | parse_events__group(NULL, list); | 130 | parse_events__set_leader(NULL, list); |
131 | $$ = list; | 131 | $$ = list; |
132 | } | 132 | } |
133 | 133 | ||
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index f5bba4b8eb9e..27187f0b71f0 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -825,7 +825,7 @@ static PyObject *pyrf_evlist__open(struct pyrf_evlist *pevlist, | |||
825 | return NULL; | 825 | return NULL; |
826 | 826 | ||
827 | if (group) | 827 | if (group) |
828 | perf_evlist__group(evlist); | 828 | perf_evlist__set_leader(evlist); |
829 | 829 | ||
830 | if (perf_evlist__open(evlist) < 0) { | 830 | if (perf_evlist__open(evlist) < 0) { |
831 | PyErr_SetFromErrno(PyExc_OSError); | 831 | PyErr_SetFromErrno(PyExc_OSError); |