perf parse-events: Minor __add_event refactoring
authorIan Rogers <irogers@google.com>
Sat, 19 Jul 2025 03:05:12 +0000 (20:05 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 24 Jul 2025 20:41:35 +0000 (13:41 -0700)
commitcd63c22168257a0b0b59245394915e2488065f7d
tree8069bf3b9dc38accefcae258805896394490c4fb
parent3cb614a261e43a82acfef437c3242820c1444e2d
perf parse-events: Minor __add_event refactoring

Rename cpu_list to user_cpus. If a PMU isn't given, find it early from
the perf_event_attr. Make the pmu_cpus more explicitly a copy from the
PMU (except when user_cpus are given). Derive the cpus from pmu_cpus
and user_cpus as appropriate. Handle strdup errors on name and
metric_id.

Reviewed-by: Thomas Falcon <thomas.falcon@intel.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: James Clark <james.clark@linaro.org>
Link: https://lore.kernel.org/r/20250719030517.1990983-11-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/parse-events.c