Skip to content

Commit

Permalink
perf tests: Fix Track with sched_switch test for hybrid case
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ahunter6 authored and acmel committed Aug 10, 2022
1 parent 2e82858 commit 1da1d60
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tools/perf/tests/switch-tracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ static int process_events(struct evlist *evlist,
static int test__switch_tracking(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
{
const char *sched_switch = "sched:sched_switch";
const char *cycles = "cycles:u";
struct switch_tracking switch_tracking = { .tids = NULL, };
struct record_opts opts = {
.mmap_pages = UINT_MAX,
Expand Down Expand Up @@ -372,12 +373,19 @@ static int test__switch_tracking(struct test_suite *test __maybe_unused, int sub
cpu_clocks_evsel = evlist__last(evlist);

/* Second event */
if (perf_pmu__has_hybrid())
err = parse_events(evlist, "cpu_core/cycles/u", NULL);
else
err = parse_events(evlist, "cycles:u", NULL);
if (perf_pmu__has_hybrid()) {
cycles = "cpu_core/cycles/u";
err = parse_events(evlist, cycles, NULL);
if (err) {
cycles = "cpu_atom/cycles/u";
pr_debug("Trying %s\n", cycles);
err = parse_events(evlist, cycles, NULL);
}
} else {
err = parse_events(evlist, cycles, NULL);
}
if (err) {
pr_debug("Failed to parse event cycles:u\n");
pr_debug("Failed to parse event %s\n", cycles);
goto out_err;
}

Expand Down

0 comments on commit 1da1d60

Please sign in to comment.