Re: [RFC PATCH v1 18/37] perf evsel: add evsel__prepare_open function

From: Arnaldo Carvalho de Melo
Date: Tue Aug 31 2021 - 15:36:44 EST


Em Sat, Aug 21, 2021 at 11:19:24AM +0200, Riccardo Mancini escreveu:
> This function will prepare the evsel and disable the missing features.
> It will be used in one of the following patches.

Applied, fixed up this:

int evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus,
struct perf_thread_map *threads)

I.e. the alignment of the second line with parms, please use this form
in your next patches.

- Arnaldo

> Signed-off-by: Riccardo Mancini <rickyman7@xxxxxxxxx>
> ---
> tools/perf/util/evsel.c | 14 ++++++++++++++
> tools/perf/util/evsel.h | 2 ++
> 2 files changed, 16 insertions(+)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index f0bc89f743915800..4e9a3e62075305f1 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -1827,6 +1827,20 @@ static void evsel__disable_missing_features(struct evsel *evsel)
> evsel->core.attr.sample_id_all = 0;
> }
>
> +int evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus,
> + struct perf_thread_map *threads)
> +{
> + int err;
> +
> + err = __evsel__prepare_open(evsel, cpus, threads);
> + if (err)
> + return err;
> +
> + evsel__disable_missing_features(evsel);
> +
> + return err;
> +}
> +
> static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
> struct perf_thread_map *threads,
> int start_cpu, int end_cpu)
> diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
> index 1c0057e80d080f2f..58aa998e1814ac9e 100644
> --- a/tools/perf/util/evsel.h
> +++ b/tools/perf/util/evsel.h
> @@ -286,6 +286,8 @@ int evsel__open_per_thread(struct evsel *evsel, struct perf_thread_map *threads)
> int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
> struct perf_thread_map *threads);
> void evsel__close(struct evsel *evsel);
> +int evsel__prepare_open(struct evsel *evsel, struct perf_cpu_map *cpus,
> + struct perf_thread_map *threads);
>
> struct perf_sample;
>
> --
> 2.31.1

--

- Arnaldo