Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit deb44a6

Browse files
ahunter6acmel
authored andcommitted
perf tests: Fix Convert perf time to TSC test for hybrid
The test does not always correctly determine the number of events for hybrids, nor allow for more than 1 evsel when parsing. Fix by iterating the events actually created and getting the correct evsel for the events processed. Fixes: d9da6f7 ("perf tests: Support 'Convert perf time to TSC' test for hybrid") Reviewed-by: Kan Liang <[email protected]> Signed-off-by: Adrian Hunter <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jin Yao <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Thomas Richter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 498c7a5 commit deb44a6

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

tools/perf/tests/perf-time-to-tsc.c

+4-14
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#include "tsc.h"
2121
#include "mmap.h"
2222
#include "tests.h"
23-
#include "pmu.h"
24-
#include "pmu-hybrid.h"
2523

2624
/*
2725
* 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
106104

107105
evlist__config(evlist, &opts, NULL);
108106

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) {
121109
evsel->core.attr.comm = 1;
122110
evsel->core.attr.disabled = 1;
123111
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
170158
goto next_event;
171159

172160
if (strcmp(event->comm.comm, comm1) == 0) {
161+
CHECK_NOT_NULL__(evsel = evlist__event2evsel(evlist, event));
173162
CHECK__(evsel__parse_sample(evsel, event, &sample));
174163
comm1_time = sample.time;
175164
}
176165
if (strcmp(event->comm.comm, comm2) == 0) {
166+
CHECK_NOT_NULL__(evsel = evlist__event2evsel(evlist, event));
177167
CHECK__(evsel__parse_sample(evsel, event, &sample));
178168
comm2_time = sample.time;
179169
}

0 commit comments

Comments
 (0)