]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf test: Switch cycles event to cpu-cycles
authorIan Rogers <irogers@google.com>
Sun, 5 Oct 2025 18:24:27 +0000 (11:24 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 15 Oct 2025 14:59:12 +0000 (23:59 +0900)
Without a PMU perf matches an event against any PMU with the
event. Unfortunately some PMU drivers advertise a "cycles" event which
is typically just a core event. As tests assume a core event, switch
to use "cpu-cycles" that avoids the overloaded "cycles" event on
troublesome PMUs and is so far not overloaded. Note, on x86 this
changes a legacy event into a sysfs one.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: James Clark <james.clark@linaro.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/tests/code-reading.c
tools/perf/tests/keep-tracking.c
tools/perf/tests/perf-time-to-tsc.c
tools/perf/tests/switch-tracking.c

index 1acb12b1a2eb31d3791978f82dac3b4bbc5fdf8b..5927d1ea20e2233145c478d6a443fb83a186b3d4 100644 (file)
@@ -704,7 +704,7 @@ static int do_test_code_reading(bool try_kcore)
        struct map *map;
        bool have_vmlinux, have_kcore;
        struct dso *dso;
-       const char *events[] = { "cycles", "cycles:u", "cpu-clock", "cpu-clock:u", NULL };
+       const char *events[] = { "cpu-cycles", "cpu-cycles:u", "cpu-clock", "cpu-clock:u", NULL };
        int evidx = 0;
        struct perf_env host_env;
 
index eafb49eb0b56b778b0332bbc372ff66218799dff..729cc9cc1cb77f4adb5b1417d8c7568c24c11e27 100644 (file)
@@ -90,7 +90,7 @@ static int test__keep_tracking(struct test_suite *test __maybe_unused, int subte
        perf_evlist__set_maps(&evlist->core, cpus, threads);
 
        CHECK__(parse_event(evlist, "dummy:u"));
-       CHECK__(parse_event(evlist, "cycles:u"));
+       CHECK__(parse_event(evlist, "cpu-cycles:u"));
 
        evlist__config(evlist, &opts, NULL);
 
index d4437410c99f45a08e79a77584809dd0878917c3..cca41bd37ae3c2e08de83e4b6281ec36d6a408a0 100644 (file)
@@ -101,11 +101,11 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su
 
        perf_evlist__set_maps(&evlist->core, cpus, threads);
 
-       CHECK__(parse_event(evlist, "cycles:u"));
+       CHECK__(parse_event(evlist, "cpu-cycles:u"));
 
        evlist__config(evlist, &opts, NULL);
 
-       /* For hybrid "cycles:u", it creates two events */
+       /* For hybrid "cpu-cycles:u", it creates two events */
        evlist__for_each_entry(evlist, evsel) {
                evsel->core.attr.comm = 1;
                evsel->core.attr.disabled = 1;
index 5be294014d3b5ab289fadb2a76297bf21d6936fe..15791fcb76b2f0d57f16711de66d075029257c00 100644 (file)
@@ -332,7 +332,7 @@ out_free_nodes:
 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";
+       const char *cycles = "cpu-cycles:u";
        struct switch_tracking switch_tracking = { .tids = NULL, };
        struct record_opts opts = {
                .mmap_pages          = UINT_MAX,