aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2025-07-24 16:32:49 +0000
committerNamhyung Kim <[email protected]>2025-07-25 17:37:56 +0000
commitc3e5b9ec96dee864c2d6b00fbfe52e784f0d7bee (patch)
tree97bfe05652e699c9e314aeea01b661fb49750ab5 /tools/perf/util/session.c
parentperf record: Make --buildid-mmap the default (diff)
downloadkernel-c3e5b9ec96dee864c2d6b00fbfe52e784f0d7bee.tar.gz
kernel-c3e5b9ec96dee864c2d6b00fbfe52e784f0d7bee.zip
perf session: Add accessor for session->header.env
The perf_env from the header in the session is frequently accessed, add an accessor function rather than access directly. Cache the value to avoid repeated calls. No behavioral change. Signed-off-by: Ian Rogers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 38075059086c..b09d157f7d04 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -2558,7 +2558,7 @@ int perf_session__cpu_bitmap(struct perf_session *session,
{
int i, err = -1;
struct perf_cpu_map *map;
- int nr_cpus = min(session->header.env.nr_cpus_avail, MAX_NR_CPUS);
+ int nr_cpus = min(perf_session__env(session)->nr_cpus_avail, MAX_NR_CPUS);
struct perf_cpu cpu;
for (i = 0; i < PERF_TYPE_MAX; ++i) {
@@ -2747,3 +2747,8 @@ int perf_session__dsos_hit_all(struct perf_session *session)
return 0;
}
+
+struct perf_env *perf_session__env(struct perf_session *session)
+{
+ return &session->header.env;
+}