perf evsel: Constify option arguments to config functions

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>
This commit is contained in:
Ian Rogers
2026-03-18 16:45:58 -07:00
committed by Namhyung Kim
parent 8ebb69e549
commit 443556be8a
2 changed files with 14 additions and 14 deletions

View 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;

View 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);