xref: /linux/tools/perf/util/sample-raw.c (revision a77ecea7ced2fef7cc0a8ad0323542f781ad9788)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include "sample-raw.h"
3 
4 #include <elf.h>
5 #include <linux/string.h>
6 
7 #include "env.h"
8 #include "evlist.h"
9 #include "header.h"
10 #include "session.h"
11 
12 /*
13  * Check platform the perf data file was created on and perform platform
14  * specific interpretation.
15  */
16 void evlist__init_trace_event_sample_raw(struct evlist *evlist, struct perf_env *env)
17 {
18 	uint16_t e_machine = perf_env__e_machine(env, /*e_flags=*/NULL);
19 
20 	if (e_machine == EM_S390) {
21 		evlist->trace_event_sample_raw = evlist__s390_sample_raw;
22 	} else if (e_machine == EM_X86_64 || e_machine == EM_386) {
23 		const char *cpuid = perf_env__cpuid(env);
24 
25 		if (cpuid && strstarts(cpuid, "AuthenticAMD") && evlist__has_amd_ibs(evlist))
26 			evlist->trace_event_sample_raw = evlist__amd_sample_raw;
27 	}
28 }
29