[PATCH v5 10/23] perf session: Add an env pointer for the current perf_env
Ian Rogers
irogers at google.com
Tue Jul 1 10:00:48 PDT 2025
On Mon, Jun 30, 2025 at 11:27 PM Namhyung Kim <namhyung at kernel.org> wrote:
>
> On Fri, Jun 27, 2025 at 09:50:04PM -0700, Ian Rogers wrote:
> > Initialize to `&header.env`. This will later allow the env value to be
> > changed.
>
> I'm curious when it is changed.
Thanks for the reviews! I'll dig into them for v6. Looking at this one
I don't see a current use of the changed perf_session__env so I
suspect we can drop the change. I need to think about the lifetime of
header.env, use cases where have >1 env like perf inject (in vs out),
perf diff and what's going on with TUI in patch:
https://lore.kernel.org/lkml/20250628045017.1361563-12-irogers@google.com/
Thanks,
Ian
> Thanks,
> Namhyung
>
> >
> > Signed-off-by: Ian Rogers <irogers at google.com>
> > ---
> > tools/perf/util/session.c | 3 ++-
> > tools/perf/util/session.h | 2 ++
> > 2 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> > index b09d157f7d04..e39a1df7c044 100644
> > --- a/tools/perf/util/session.c
> > +++ b/tools/perf/util/session.c
> > @@ -156,6 +156,7 @@ struct perf_session *__perf_session__new(struct perf_data *data,
> > ordered_events__deliver_event, NULL);
> >
> > perf_env__init(&session->header.env);
> > + session->env = &session->header.env;
> > if (data) {
> > ret = perf_data__open(data);
> > if (ret < 0)
> > @@ -2750,5 +2751,5 @@ int perf_session__dsos_hit_all(struct perf_session *session)
> >
> > struct perf_env *perf_session__env(struct perf_session *session)
> > {
> > - return &session->header.env;
> > + return session->env;
> > }
> > diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
> > index e7f7464b838f..088868f1004a 100644
> > --- a/tools/perf/util/session.h
> > +++ b/tools/perf/util/session.h
> > @@ -45,6 +45,8 @@ struct perf_session {
> > struct perf_header header;
> > /** @machines: Machines within the session a host and 0 or more guests. */
> > struct machines machines;
> > + /** @env: The perf_env being worked with, either from a data file or the host's. */
> > + struct perf_env *env;
> > /** @evlist: List of evsels/events of the session. */
> > struct evlist *evlist;
> > /** @auxtrace: callbacks to allow AUX area data decoding. */
> > --
> > 2.50.0.727.gbf7dc18ff4-goog
> >
More information about the linux-arm-kernel
mailing list