|
20 | 20 | #include "tsc.h" |
21 | 21 | #include "mmap.h" |
22 | 22 | #include "tests.h" |
23 | | -#include "pmu.h" |
24 | | -#include "pmu-hybrid.h" |
25 | 23 |
|
26 | 24 | /* |
27 | 25 | * Except x86_64/i386 and Arm64, other archs don't support TSC in perf. Just |
@@ -106,28 +104,21 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su |
106 | 104 |
|
107 | 105 | evlist__config(evlist, &opts, NULL); |
108 | 106 |
|
109 | | - evsel = evlist__first(evlist); |
110 | | - |
111 | | - evsel->core.attr.comm = 1; |
112 | | - evsel->core.attr.disabled = 1; |
113 | | - evsel->core.attr.enable_on_exec = 0; |
114 | | - |
115 | | - /* |
116 | | - * For hybrid "cycles:u", it creates two events. |
117 | | - * Init the second evsel here. |
118 | | - */ |
119 | | - if (perf_pmu__has_hybrid() && perf_pmu__hybrid_mounted("cpu_atom")) { |
120 | | - evsel = evsel__next(evsel); |
| 107 | + /* For hybrid "cycles:u", it creates two events */ |
| 108 | + evlist__for_each_entry(evlist, evsel) { |
121 | 109 | evsel->core.attr.comm = 1; |
122 | 110 | evsel->core.attr.disabled = 1; |
123 | 111 | evsel->core.attr.enable_on_exec = 0; |
124 | 112 | } |
125 | 113 |
|
126 | | - if (evlist__open(evlist) == -ENOENT) { |
127 | | - err = TEST_SKIP; |
| 114 | + ret = evlist__open(evlist); |
| 115 | + if (ret < 0) { |
| 116 | + if (ret == -ENOENT) |
| 117 | + err = TEST_SKIP; |
| 118 | + else |
| 119 | + pr_debug("evlist__open() failed\n"); |
128 | 120 | goto out_err; |
129 | 121 | } |
130 | | - CHECK__(evlist__open(evlist)); |
131 | 122 |
|
132 | 123 | CHECK__(evlist__mmap(evlist, UINT_MAX)); |
133 | 124 |
|
@@ -167,10 +158,12 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su |
167 | 158 | goto next_event; |
168 | 159 |
|
169 | 160 | if (strcmp(event->comm.comm, comm1) == 0) { |
| 161 | + CHECK_NOT_NULL__(evsel = evlist__event2evsel(evlist, event)); |
170 | 162 | CHECK__(evsel__parse_sample(evsel, event, &sample)); |
171 | 163 | comm1_time = sample.time; |
172 | 164 | } |
173 | 165 | if (strcmp(event->comm.comm, comm2) == 0) { |
| 166 | + CHECK_NOT_NULL__(evsel = evlist__event2evsel(evlist, event)); |
174 | 167 | CHECK__(evsel__parse_sample(evsel, event, &sample)); |
175 | 168 | comm2_time = sample.time; |
176 | 169 | } |
|
0 commit comments