diff options
| author | Ian Rogers <[email protected]> | 2025-07-24 16:32:49 +0000 |
|---|---|---|
| committer | Namhyung Kim <[email protected]> | 2025-07-25 17:37:56 +0000 |
| commit | c3e5b9ec96dee864c2d6b00fbfe52e784f0d7bee (patch) | |
| tree | 97bfe05652e699c9e314aeea01b661fb49750ab5 /tools/perf/util/session.c | |
| parent | perf record: Make --buildid-mmap the default (diff) | |
| download | kernel-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.c | 7 |
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; +} |
