|
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,18 +104,8 @@ 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; |
@@ -170,10 +158,12 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su |
170 | 158 | goto next_event; |
171 | 159 |
|
172 | 160 | if (strcmp(event->comm.comm, comm1) == 0) { |
| 161 | + CHECK_NOT_NULL__(evsel = evlist__event2evsel(evlist, event)); |
173 | 162 | CHECK__(evsel__parse_sample(evsel, event, &sample)); |
174 | 163 | comm1_time = sample.time; |
175 | 164 | } |
176 | 165 | if (strcmp(event->comm.comm, comm2) == 0) { |
| 166 | + CHECK_NOT_NULL__(evsel = evlist__event2evsel(evlist, event)); |
177 | 167 | CHECK__(evsel__parse_sample(evsel, event, &sample)); |
178 | 168 | comm2_time = sample.time; |
179 | 169 | } |
|
0 commit comments