diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-10 08:37:27 -0500 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-13 08:06:25 -0500 |
| commit | 0050f7aa182e3e8ed34dd6cc4318e52b3df6347a (patch) | |
| tree | 472540f557462f51a73b7cd44c27792edd48e4d8 /tools/perf/tests | |
| parent | f6d8b0571c9ac8f273d18c112c2fc3c9533c9f0a (diff) | |
perf evlist: Introduce evlist__for_each() & friends
For the common evsel list traversal, so that it becomes more compact.
Use the opportunity to start ditching the 'perf_' from 'perf_evlist__',
as discussed, as the whole conversion touches a lot of places, lets do
it piecemeal when we have the chance due to other work, like in this
case.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-qnkx7dzm2h6m6uptkfk03ni6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests')
| -rw-r--r-- | tools/perf/tests/evsel-roundtrip-name.c | 2 | ||||
| -rw-r--r-- | tools/perf/tests/hists_link.c | 4 | ||||
| -rw-r--r-- | tools/perf/tests/mmap-basic.c | 2 | ||||
| -rw-r--r-- | tools/perf/tests/parse-events.c | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/tools/perf/tests/evsel-roundtrip-name.c b/tools/perf/tests/evsel-roundtrip-name.c index 0197bda9c461..465cdbc345cf 100644 --- a/tools/perf/tests/evsel-roundtrip-name.c +++ b/tools/perf/tests/evsel-roundtrip-name.c | |||
| @@ -79,7 +79,7 @@ static int __perf_evsel__name_array_test(const char *names[], int nr_names) | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | err = 0; | 81 | err = 0; |
| 82 | list_for_each_entry(evsel, &evlist->entries, node) { | 82 | evlist__for_each(evlist, evsel) { |
| 83 | if (strcmp(perf_evsel__name(evsel), names[evsel->idx])) { | 83 | if (strcmp(perf_evsel__name(evsel), names[evsel->idx])) { |
| 84 | --err; | 84 | --err; |
| 85 | pr_debug("%s != %s\n", perf_evsel__name(evsel), names[evsel->idx]); | 85 | pr_debug("%s != %s\n", perf_evsel__name(evsel), names[evsel->idx]); |
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index 173bf42cc03e..2b6519e0e36f 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c | |||
| @@ -208,7 +208,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) | |||
| 208 | * However the second evsel also has a collapsed entry for | 208 | * However the second evsel also has a collapsed entry for |
| 209 | * "bash [libc] malloc" so total 9 entries will be in the tree. | 209 | * "bash [libc] malloc" so total 9 entries will be in the tree. |
| 210 | */ | 210 | */ |
| 211 | list_for_each_entry(evsel, &evlist->entries, node) { | 211 | evlist__for_each(evlist, evsel) { |
| 212 | for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { | 212 | for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { |
| 213 | const union perf_event event = { | 213 | const union perf_event event = { |
| 214 | .header = { | 214 | .header = { |
| @@ -466,7 +466,7 @@ int test__hists_link(void) | |||
| 466 | if (err < 0) | 466 | if (err < 0) |
| 467 | goto out; | 467 | goto out; |
| 468 | 468 | ||
| 469 | list_for_each_entry(evsel, &evlist->entries, node) { | 469 | evlist__for_each(evlist, evsel) { |
| 470 | hists__collapse_resort(&evsel->hists, NULL); | 470 | hists__collapse_resort(&evsel->hists, NULL); |
| 471 | 471 | ||
| 472 | if (verbose > 2) | 472 | if (verbose > 2) |
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index aef25f0ff9cc..142263492f6f 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c | |||
| @@ -126,7 +126,7 @@ int test__basic_mmap(void) | |||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | err = 0; | 128 | err = 0; |
| 129 | list_for_each_entry(evsel, &evlist->entries, node) { | 129 | evlist__for_each(evlist, evsel) { |
| 130 | if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) { | 130 | if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) { |
| 131 | pr_debug("expected %d %s events, got %d\n", | 131 | pr_debug("expected %d %s events, got %d\n", |
| 132 | expected_nr_events[evsel->idx], | 132 | expected_nr_events[evsel->idx], |
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 41dee5e67f63..4db0ae617d70 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
| @@ -30,7 +30,7 @@ static int test__checkevent_tracepoint_multi(struct perf_evlist *evlist) | |||
| 30 | TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); | 30 | TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); |
| 31 | TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); | 31 | TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); |
| 32 | 32 | ||
| 33 | list_for_each_entry(evsel, &evlist->entries, node) { | 33 | evlist__for_each(evlist, evsel) { |
| 34 | TEST_ASSERT_VAL("wrong type", | 34 | TEST_ASSERT_VAL("wrong type", |
| 35 | PERF_TYPE_TRACEPOINT == evsel->attr.type); | 35 | PERF_TYPE_TRACEPOINT == evsel->attr.type); |
| 36 | TEST_ASSERT_VAL("wrong sample_type", | 36 | TEST_ASSERT_VAL("wrong sample_type", |
| @@ -201,7 +201,7 @@ test__checkevent_tracepoint_multi_modifier(struct perf_evlist *evlist) | |||
| 201 | 201 | ||
| 202 | TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); | 202 | TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); |
| 203 | 203 | ||
| 204 | list_for_each_entry(evsel, &evlist->entries, node) { | 204 | evlist__for_each(evlist, evsel) { |
| 205 | TEST_ASSERT_VAL("wrong exclude_user", | 205 | TEST_ASSERT_VAL("wrong exclude_user", |
| 206 | !evsel->attr.exclude_user); | 206 | !evsel->attr.exclude_user); |
| 207 | TEST_ASSERT_VAL("wrong exclude_kernel", | 207 | TEST_ASSERT_VAL("wrong exclude_kernel", |
