]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf evsel: Move evsel__* functions to evsel.c
authorJames Clark <james.clark@linaro.org>
Wed, 14 Jan 2026 15:57:15 +0000 (15:57 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 15 Jan 2026 02:14:13 +0000 (23:14 -0300)
At least one of these were put here to avoid a Python binding linking
issue which is no longer present. Put them back in their correct
location to avoid confusion about which file to add a new evsel__*
function to later.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/all/ZEbAS2yx2fguW60w@kernel.org/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evsel.c
tools/perf/util/pmu.c

index e2de642fbf53a961bc1632fd1670d410650aae4d..27bdef01beaf593b2e8d9cb6c273bef2711d3293 100644 (file)
@@ -1315,6 +1315,35 @@ struct evsel_config_term *__evsel__get_config_term(struct evsel *evsel, enum evs
        return found_term;
 }
 
+/*
+ * Set @config_name to @val as long as the user hasn't already set or cleared it
+ * by passing a config term on the command line.
+ *
+ * @val is the value to put into the bits specified by @config_name rather than
+ * the bit pattern. It is shifted into position by this function, so to set
+ * something to true, pass 1 for val rather than a pre shifted value.
+ */
+#define field_prep(_mask, _val) (((_val) << (ffsll(_mask) - 1)) & (_mask))
+void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
+                               u64 val)
+{
+       u64 user_bits = 0, bits;
+       struct evsel_config_term *term = evsel__get_config_term(evsel, CFG_CHG);
+
+       if (term)
+               user_bits = term->val.cfg_chg;
+
+       bits = perf_pmu__format_bits(evsel->pmu, config_name);
+
+       /* Do nothing if the user changed the value */
+       if (bits & user_bits)
+               return;
+
+       /* Otherwise replace it */
+       evsel->core.attr.config &= ~bits;
+       evsel->core.attr.config |= field_prep(bits, val);
+}
+
 void __weak arch_evsel__set_sample_weight(struct evsel *evsel)
 {
        evsel__set_sample_bit(evsel, WEIGHT);
@@ -4099,6 +4128,17 @@ void evsel__set_leader(struct evsel *evsel, struct evsel *leader)
        evsel->core.leader = &leader->core;
 }
 
+bool evsel__is_aux_event(const struct evsel *evsel)
+{
+       struct perf_pmu *pmu;
+
+       if (evsel->needs_auxtrace_mmap)
+               return true;
+
+       pmu = evsel__find_pmu(evsel);
+       return pmu && pmu->auxtrace;
+}
+
 int evsel__source_count(const struct evsel *evsel)
 {
        struct evsel *pos;
index e87c12946d71a352edb980684c4c7133a7d08eb8..e3a1f26213ecf3f5139b4318d20d3bb4b6721059 100644 (file)
@@ -1362,46 +1362,6 @@ void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu)
        }
 }
 
-bool evsel__is_aux_event(const struct evsel *evsel)
-{
-       struct perf_pmu *pmu;
-
-       if (evsel->needs_auxtrace_mmap)
-               return true;
-
-       pmu = evsel__find_pmu(evsel);
-       return pmu && pmu->auxtrace;
-}
-
-/*
- * Set @config_name to @val as long as the user hasn't already set or cleared it
- * by passing a config term on the command line.
- *
- * @val is the value to put into the bits specified by @config_name rather than
- * the bit pattern. It is shifted into position by this function, so to set
- * something to true, pass 1 for val rather than a pre shifted value.
- */
-#define field_prep(_mask, _val) (((_val) << (ffsll(_mask) - 1)) & (_mask))
-void evsel__set_config_if_unset(struct evsel *evsel, const char *config_name,
-                               u64 val)
-{
-       u64 user_bits = 0, bits;
-       struct evsel_config_term *term = evsel__get_config_term(evsel, CFG_CHG);
-
-       if (term)
-               user_bits = term->val.cfg_chg;
-
-       bits = perf_pmu__format_bits(evsel->pmu, config_name);
-
-       /* Do nothing if the user changed the value */
-       if (bits & user_bits)
-               return;
-
-       /* Otherwise replace it */
-       evsel->core.attr.config &= ~bits;
-       evsel->core.attr.config |= field_prep(bits, val);
-}
-
 static struct perf_pmu_format *
 pmu_find_format(const struct list_head *formats, const char *name)
 {