Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1da1d60

Browse files
ahunter6acmel
authored andcommitted
perf tests: Fix Track with sched_switch test for hybrid case
If cpu_core PMU event fails to parse, try also cpu_atom PMU event when parsing cycles event. Fixes: 43eb05d ("perf tests: Support 'Track with sched_switch' test for hybrid") 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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 2e82858 commit 1da1d60

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

tools/perf/tests/switch-tracking.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ static int process_events(struct evlist *evlist,
324324
static int test__switch_tracking(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
325325
{
326326
const char *sched_switch = "sched:sched_switch";
327+
const char *cycles = "cycles:u";
327328
struct switch_tracking switch_tracking = { .tids = NULL, };
328329
struct record_opts opts = {
329330
.mmap_pages = UINT_MAX,
@@ -372,12 +373,19 @@ static int test__switch_tracking(struct test_suite *test __maybe_unused, int sub
372373
cpu_clocks_evsel = evlist__last(evlist);
373374

374375
/* Second event */
375-
if (perf_pmu__has_hybrid())
376-
err = parse_events(evlist, "cpu_core/cycles/u", NULL);
377-
else
378-
err = parse_events(evlist, "cycles:u", NULL);
376+
if (perf_pmu__has_hybrid()) {
377+
cycles = "cpu_core/cycles/u";
378+
err = parse_events(evlist, cycles, NULL);
379+
if (err) {
380+
cycles = "cpu_atom/cycles/u";
381+
pr_debug("Trying %s\n", cycles);
382+
err = parse_events(evlist, cycles, NULL);
383+
}
384+
} else {
385+
err = parse_events(evlist, cycles, NULL);
386+
}
379387
if (err) {
380-
pr_debug("Failed to parse event cycles:u\n");
388+
pr_debug("Failed to parse event %s\n", cycles);
381389
goto out_err;
382390
}
383391

0 commit comments

Comments
 (0)