diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-11-29 01:38:30 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-12-09 06:46:06 -0500 |
commit | 823254edc66eb44bf612b1dfa4829afa9840f691 (patch) | |
tree | 50f6c26d96228717f35dbf989ca0534bbda9ca11 | |
parent | 2cfda562da7b0b1e0575507ef3efe782d4e218e4 (diff) |
perf evsel: Convert to _is_group_leader method
Convert perf_evsel__is_group_member to perf_evsel__is_group_leader.
This is because the most usecases are using negative form to check
whether the given evsel is a leader or not and it's IMHO somewhat
ambiguous - leader also *is* a member of the group.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1354171126-14387-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-stat.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/parse-events.c | 20 | ||||
-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 | 4 |
5 files changed, 18 insertions, 18 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index c247faca7127..c12655af2b88 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -153,7 +153,7 @@ retry: | |||
153 | } | 153 | } |
154 | 154 | ||
155 | if (!perf_target__has_task(&target) && | 155 | if (!perf_target__has_task(&target) && |
156 | !perf_evsel__is_group_member(evsel)) { | 156 | perf_evsel__is_group_leader(evsel)) { |
157 | attr->disabled = 1; | 157 | attr->disabled = 1; |
158 | attr->enable_on_exec = 1; | 158 | attr->enable_on_exec = 1; |
159 | } | 159 | } |
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 32ee478905eb..294ffddfbf42 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
@@ -521,7 +521,7 @@ static int test__group1(struct perf_evlist *evlist) | |||
521 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 521 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
522 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 522 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
523 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 523 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
524 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 524 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
525 | 525 | ||
526 | /* cycles:upp */ | 526 | /* cycles:upp */ |
527 | evsel = perf_evsel__next(evsel); | 527 | evsel = perf_evsel__next(evsel); |
@@ -557,7 +557,7 @@ static int test__group2(struct perf_evlist *evlist) | |||
557 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 557 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
558 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 558 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
559 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 559 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
560 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 560 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
561 | 561 | ||
562 | /* cache-references + :u modifier */ | 562 | /* cache-references + :u modifier */ |
563 | evsel = perf_evsel__next(evsel); | 563 | evsel = perf_evsel__next(evsel); |
@@ -583,7 +583,7 @@ static int test__group2(struct perf_evlist *evlist) | |||
583 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 583 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
584 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 584 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
585 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 585 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
586 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 586 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
587 | 587 | ||
588 | return 0; | 588 | return 0; |
589 | } | 589 | } |
@@ -606,7 +606,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
606 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | 606 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
607 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 607 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
608 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 608 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
609 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 609 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
610 | TEST_ASSERT_VAL("wrong group name", | 610 | TEST_ASSERT_VAL("wrong group name", |
611 | !strcmp(leader->group_name, "group1")); | 611 | !strcmp(leader->group_name, "group1")); |
612 | 612 | ||
@@ -636,7 +636,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
636 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 636 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
637 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | 637 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
638 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 638 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
639 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 639 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
640 | TEST_ASSERT_VAL("wrong group name", | 640 | TEST_ASSERT_VAL("wrong group name", |
641 | !strcmp(leader->group_name, "group2")); | 641 | !strcmp(leader->group_name, "group2")); |
642 | 642 | ||
@@ -663,7 +663,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
663 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 663 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
664 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 664 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
665 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 665 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
666 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 666 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
667 | 667 | ||
668 | return 0; | 668 | return 0; |
669 | } | 669 | } |
@@ -687,7 +687,7 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused) | |||
687 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 687 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
688 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1); | 688 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1); |
689 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | 689 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
690 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 690 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
691 | 691 | ||
692 | /* instructions:kp + p */ | 692 | /* instructions:kp + p */ |
693 | evsel = perf_evsel__next(evsel); | 693 | evsel = perf_evsel__next(evsel); |
@@ -724,7 +724,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) | |||
724 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | 724 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
725 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 725 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
726 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | 726 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
727 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 727 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
728 | 728 | ||
729 | /* instructions + G */ | 729 | /* instructions + G */ |
730 | evsel = perf_evsel__next(evsel); | 730 | evsel = perf_evsel__next(evsel); |
@@ -751,7 +751,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) | |||
751 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | 751 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
752 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 752 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
753 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | 753 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
754 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 754 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
755 | 755 | ||
756 | /* instructions:G */ | 756 | /* instructions:G */ |
757 | evsel = perf_evsel__next(evsel); | 757 | evsel = perf_evsel__next(evsel); |
@@ -777,7 +777,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) | |||
777 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | 777 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
778 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 778 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
779 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 779 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
780 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 780 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
781 | 781 | ||
782 | return 0; | 782 | return 0; |
783 | } | 783 | } |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 90db2a14e4bb..d0e1e821fe85 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -221,7 +221,7 @@ void perf_evlist__disable(struct perf_evlist *evlist) | |||
221 | 221 | ||
222 | for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { | 222 | for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { |
223 | list_for_each_entry(pos, &evlist->entries, node) { | 223 | list_for_each_entry(pos, &evlist->entries, node) { |
224 | if (perf_evsel__is_group_member(pos)) | 224 | if (!perf_evsel__is_group_leader(pos)) |
225 | continue; | 225 | continue; |
226 | for (thread = 0; thread < evlist->threads->nr; thread++) | 226 | for (thread = 0; thread < evlist->threads->nr; thread++) |
227 | ioctl(FD(pos, cpu, thread), | 227 | ioctl(FD(pos, cpu, thread), |
@@ -237,7 +237,7 @@ void perf_evlist__enable(struct perf_evlist *evlist) | |||
237 | 237 | ||
238 | for (cpu = 0; cpu < cpu_map__nr(evlist->cpus); cpu++) { | 238 | for (cpu = 0; cpu < cpu_map__nr(evlist->cpus); cpu++) { |
239 | list_for_each_entry(pos, &evlist->entries, node) { | 239 | list_for_each_entry(pos, &evlist->entries, node) { |
240 | if (perf_evsel__is_group_member(pos)) | 240 | if (!perf_evsel__is_group_leader(pos)) |
241 | continue; | 241 | continue; |
242 | for (thread = 0; thread < evlist->threads->nr; thread++) | 242 | for (thread = 0; thread < evlist->threads->nr; thread++) |
243 | ioctl(FD(pos, cpu, thread), | 243 | ioctl(FD(pos, cpu, thread), |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 7e93418a45d1..bb58b05f905f 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -520,14 +520,14 @@ void perf_evsel__config(struct perf_evsel *evsel, | |||
520 | * Disabling only independent events or group leaders, | 520 | * Disabling only independent events or group leaders, |
521 | * keeping group members enabled. | 521 | * keeping group members enabled. |
522 | */ | 522 | */ |
523 | if (!perf_evsel__is_group_member(evsel)) | 523 | if (perf_evsel__is_group_leader(evsel)) |
524 | attr->disabled = 1; | 524 | attr->disabled = 1; |
525 | 525 | ||
526 | /* | 526 | /* |
527 | * Setting enable_on_exec for independent events and | 527 | * Setting enable_on_exec for independent events and |
528 | * group leaders for traced executed by perf. | 528 | * group leaders for traced executed by perf. |
529 | */ | 529 | */ |
530 | if (perf_target__none(&opts->target) && !perf_evsel__is_group_member(evsel)) | 530 | if (perf_target__none(&opts->target) && perf_evsel__is_group_leader(evsel)) |
531 | attr->enable_on_exec = 1; | 531 | attr->enable_on_exec = 1; |
532 | } | 532 | } |
533 | 533 | ||
@@ -708,7 +708,7 @@ static int get_group_fd(struct perf_evsel *evsel, int cpu, int thread) | |||
708 | struct perf_evsel *leader = evsel->leader; | 708 | struct perf_evsel *leader = evsel->leader; |
709 | int fd; | 709 | int fd; |
710 | 710 | ||
711 | if (!perf_evsel__is_group_member(evsel)) | 711 | if (perf_evsel__is_group_leader(evsel)) |
712 | return -1; | 712 | return -1; |
713 | 713 | ||
714 | /* | 714 | /* |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index cbf6d97f0646..3f7ff471de2b 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -226,8 +226,8 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel) | |||
226 | return list_entry(evsel->node.next, struct perf_evsel, node); | 226 | return list_entry(evsel->node.next, struct perf_evsel, node); |
227 | } | 227 | } |
228 | 228 | ||
229 | static inline bool perf_evsel__is_group_member(const struct perf_evsel *evsel) | 229 | static inline bool perf_evsel__is_group_leader(const struct perf_evsel *evsel) |
230 | { | 230 | { |
231 | return evsel->leader != evsel; | 231 | return evsel->leader == evsel; |
232 | } | 232 | } |
233 | #endif /* __PERF_EVSEL_H */ | 233 | #endif /* __PERF_EVSEL_H */ |