]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf evsel: Constify option arguments to config functions
authorIan Rogers <irogers@google.com>
Wed, 18 Mar 2026 23:45:58 +0000 (16:45 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 19 Mar 2026 21:42:46 +0000 (14:42 -0700)
The options are used to configure the evsel but are not themselves
configured. Make the arguments const to better capture this.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/evsel.c
tools/perf/util/evsel.h

index bd14d9bbc91f005b5fc26869ec1fff0237973bac..54c8922a8e473c08a30e8a4a574d3d3b03083113 100644 (file)
@@ -1015,8 +1015,8 @@ uint16_t evsel__e_machine(struct evsel *evsel, uint32_t *e_flags)
        return perf_session__e_machine(session, e_flags);
 }
 
-static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *opts,
-                                     struct callchain_param *param)
+static void __evsel__config_callchain(struct evsel *evsel, const struct record_opts *opts,
+                                     const struct callchain_param *param)
 {
        bool function = evsel__is_function_event(evsel);
        struct perf_event_attr *attr = &evsel->core.attr;
@@ -1080,14 +1080,14 @@ static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *o
                attr->defer_callchain = 1;
 }
 
-void evsel__config_callchain(struct evsel *evsel, struct record_opts *opts,
-                            struct callchain_param *param)
+void evsel__config_callchain(struct evsel *evsel, const struct record_opts *opts,
+                            const struct callchain_param *param)
 {
        if (param->enabled)
                return __evsel__config_callchain(evsel, opts, param);
 }
 
-static void evsel__reset_callgraph(struct evsel *evsel, struct callchain_param *param)
+static void evsel__reset_callgraph(struct evsel *evsel, const struct callchain_param *param)
 {
        struct perf_event_attr *attr = &evsel->core.attr;
 
@@ -1106,7 +1106,7 @@ static void evsel__reset_callgraph(struct evsel *evsel, struct callchain_param *
 
 static void evsel__apply_ratio_to_prev(struct evsel *evsel,
                                       struct perf_event_attr *attr,
-                                      struct record_opts *opts,
+                                      const struct record_opts *opts,
                                       const char *buf)
 {
        struct perf_event_attr *prev_attr = NULL;
@@ -1170,7 +1170,7 @@ static void evsel__apply_ratio_to_prev(struct evsel *evsel,
 }
 
 static void evsel__apply_config_terms(struct evsel *evsel,
-                                     struct record_opts *opts, bool track)
+                                     const struct record_opts *opts, bool track)
 {
        struct evsel_config_term *term;
        struct list_head *config_terms = &evsel->config_terms;
@@ -1445,7 +1445,7 @@ void __weak arch_evsel__apply_ratio_to_prev(struct evsel *evsel __maybe_unused,
 {
 }
 
-static void evsel__set_default_freq_period(struct record_opts *opts,
+static void evsel__set_default_freq_period(const struct record_opts *opts,
                                           struct perf_event_attr *attr)
 {
        if (opts->freq) {
@@ -1490,8 +1490,8 @@ bool evsel__is_offcpu_event(struct evsel *evsel)
  *     enable/disable events specifically, as there's no
  *     initial traced exec call.
  */
-void evsel__config(struct evsel *evsel, struct record_opts *opts,
-                  struct callchain_param *callchain)
+void evsel__config(struct evsel *evsel, const struct record_opts *opts,
+                  const struct callchain_param *callchain)
 {
        struct evsel *leader = evsel__leader(evsel);
        struct perf_event_attr *attr = &evsel->core.attr;
index 97f57fab28ce9e8461cb347e31f652116ee2ef9c..339b5c08a33d687d25b09668d04486ec6223d2b7 100644 (file)
@@ -287,10 +287,10 @@ void evsel__set_priv_destructor(void (*destructor)(void *priv));
 
 struct callchain_param;
 
-void evsel__config(struct evsel *evsel, struct record_opts *opts,
-                  struct callchain_param *callchain);
-void evsel__config_callchain(struct evsel *evsel, struct record_opts *opts,
-                            struct callchain_param *callchain);
+void evsel__config(struct evsel *evsel, const struct record_opts *opts,
+                  const struct callchain_param *callchain);
+void evsel__config_callchain(struct evsel *evsel, const struct record_opts *opts,
+                            const  struct callchain_param *callchain);
 
 int __evsel__sample_size(u64 sample_type);
 void evsel__calc_id_pos(struct evsel *evsel);