aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2025-07-24 09:32:50 -0700
committerNamhyung Kim <namhyung@kernel.org>2025-07-25 10:37:56 -0700
commit57ddb9cbb54fbf3772063795051b88a1f7258c6c (patch)
tree36f6a2e9b598aa305b9bb862fc623eeee16218fe /tools/perf/util/session.c
parentperf session: Add accessor for session->header.env (diff)
downloadlinux-57ddb9cbb54fbf3772063795051b88a1f7258c6c.tar.gz
linux-57ddb9cbb54fbf3772063795051b88a1f7258c6c.zip
perf evlist: Change env variable to session
The session holds a perf_env pointer env. In UI code container_of is used to turn the env to a session, but this assumes the session header's env is in use. Rather than a dubious container_of, hold the session in the evlist and derive the env from the session with evsel__env, perf_session__env, etc. Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20250724163302.596743-11-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index b09d157f7d04..a851d9130abd 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -177,7 +177,7 @@ struct perf_session *__perf_session__new(struct perf_data *data,
perf_session__set_comm_exec(session);
}
- evlist__init_trace_event_sample_raw(session->evlist);
+ evlist__init_trace_event_sample_raw(session->evlist, &session->header.env);
/* Open the directory data. */
if (data->is_dir) {
@@ -193,6 +193,8 @@ struct perf_session *__perf_session__new(struct perf_data *data,
} else {
session->machines.host.env = &perf_env;
}
+ if (session->evlist)
+ session->evlist->session = session;
session->machines.host.single_address_space =
perf_env__single_address_space(session->machines.host.env);