mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

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>
27 lines
769 B
C
27 lines
769 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#include <string.h>
|
|
#include <linux/string.h>
|
|
#include "evlist.h"
|
|
#include "env.h"
|
|
#include "header.h"
|
|
#include "sample-raw.h"
|
|
#include "session.h"
|
|
|
|
/*
|
|
* Check platform the perf data file was created on and perform platform
|
|
* specific interpretation.
|
|
*/
|
|
void evlist__init_trace_event_sample_raw(struct evlist *evlist, struct perf_env *env)
|
|
{
|
|
const char *arch_pf = perf_env__arch(env);
|
|
const char *cpuid = perf_env__cpuid(env);
|
|
|
|
if (arch_pf && !strcmp("s390", arch_pf))
|
|
evlist->trace_event_sample_raw = evlist__s390_sample_raw;
|
|
else if (arch_pf && !strcmp("x86", arch_pf) &&
|
|
cpuid && strstarts(cpuid, "AuthenticAMD") &&
|
|
evlist__has_amd_ibs(evlist)) {
|
|
evlist->trace_event_sample_raw = evlist__amd_sample_raw;
|
|
}
|
|
}
|