diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/evlist.c | 4 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 6 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 6 |
3 files changed, 11 insertions, 5 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index e9d2d5da2fb8..705293489e3c 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -222,7 +222,7 @@ void perf_evlist__disable(struct perf_evlist *evlist) | |||
222 | 222 | ||
223 | for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { | 223 | for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { |
224 | list_for_each_entry(pos, &evlist->entries, node) { | 224 | list_for_each_entry(pos, &evlist->entries, node) { |
225 | if (pos->leader) | 225 | if (perf_evsel__is_group_member(pos)) |
226 | continue; | 226 | continue; |
227 | for (thread = 0; thread < evlist->threads->nr; thread++) | 227 | for (thread = 0; thread < evlist->threads->nr; thread++) |
228 | ioctl(FD(pos, cpu, thread), | 228 | ioctl(FD(pos, cpu, thread), |
@@ -238,7 +238,7 @@ void perf_evlist__enable(struct perf_evlist *evlist) | |||
238 | 238 | ||
239 | for (cpu = 0; cpu < cpu_map__nr(evlist->cpus); cpu++) { | 239 | for (cpu = 0; cpu < cpu_map__nr(evlist->cpus); cpu++) { |
240 | list_for_each_entry(pos, &evlist->entries, node) { | 240 | list_for_each_entry(pos, &evlist->entries, node) { |
241 | if (pos->leader) | 241 | if (perf_evsel__is_group_member(pos)) |
242 | continue; | 242 | continue; |
243 | for (thread = 0; thread < evlist->threads->nr; thread++) | 243 | for (thread = 0; thread < evlist->threads->nr; thread++) |
244 | ioctl(FD(pos, cpu, thread), | 244 | ioctl(FD(pos, cpu, thread), |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index fc4faaa7afb9..1fb636c550a1 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -519,14 +519,14 @@ void perf_evsel__config(struct perf_evsel *evsel, | |||
519 | * Disabling only independent events or group leaders, | 519 | * Disabling only independent events or group leaders, |
520 | * keeping group members enabled. | 520 | * keeping group members enabled. |
521 | */ | 521 | */ |
522 | if (!evsel->leader) | 522 | if (!perf_evsel__is_group_member(evsel)) |
523 | attr->disabled = 1; | 523 | attr->disabled = 1; |
524 | 524 | ||
525 | /* | 525 | /* |
526 | * Setting enable_on_exec for independent events and | 526 | * Setting enable_on_exec for independent events and |
527 | * group leaders for traced executed by perf. | 527 | * group leaders for traced executed by perf. |
528 | */ | 528 | */ |
529 | if (perf_target__none(&opts->target) && (!evsel->leader)) | 529 | if (perf_target__none(&opts->target) && !perf_evsel__is_group_member(evsel)) |
530 | attr->enable_on_exec = 1; | 530 | attr->enable_on_exec = 1; |
531 | } | 531 | } |
532 | 532 | ||
@@ -707,7 +707,7 @@ static int get_group_fd(struct perf_evsel *evsel, int cpu, int thread) | |||
707 | struct perf_evsel *leader = evsel->leader; | 707 | struct perf_evsel *leader = evsel->leader; |
708 | int fd; | 708 | int fd; |
709 | 709 | ||
710 | if (!leader) | 710 | if (!perf_evsel__is_group_member(evsel)) |
711 | return -1; | 711 | return -1; |
712 | 712 | ||
713 | /* | 713 | /* |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 32d7ec78dedc..a4c1dd4e149f 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
6 | #include <stddef.h> | ||
6 | #include "../../../include/uapi/linux/perf_event.h" | 7 | #include "../../../include/uapi/linux/perf_event.h" |
7 | #include "types.h" | 8 | #include "types.h" |
8 | #include "xyarray.h" | 9 | #include "xyarray.h" |
@@ -224,4 +225,9 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel) | |||
224 | { | 225 | { |
225 | return list_entry(evsel->node.next, struct perf_evsel, node); | 226 | return list_entry(evsel->node.next, struct perf_evsel, node); |
226 | } | 227 | } |
228 | |||
229 | static inline bool perf_evsel__is_group_member(const struct perf_evsel *evsel) | ||
230 | { | ||
231 | return evsel->leader != NULL; | ||
232 | } | ||
227 | #endif /* __PERF_EVSEL_H */ | 233 | #endif /* __PERF_EVSEL_H */ |