7 #include <linux/kernel.h> 8 #include <linux/types.h> 9 #include <linux/bitops.h> 10 #include <linux/log2.h> 13 #include "../../util/cpumap.h" 14 #include "../../util/evsel.h" 15 #include "../../util/evlist.h" 16 #include "../../util/session.h" 17 #include "../../util/util.h" 18 #include "../../util/pmu.h" 19 #include "../../util/debug.h" 20 #include "../../util/auxtrace.h" 21 #include "../../util/arm-spe.h" 23 #define KiB(x) ((x) * 1024) 24 #define MiB(x) ((x) * 1024 * 1024) 67 struct perf_evsel *evsel, *arm_spe_evsel = NULL;
75 if (evsel->
attr.type == arm_spe_pmu->
type) {
81 evsel->
attr.sample_period = 1;
82 arm_spe_evsel = evsel;
104 size_t min_sz =
KiB(8);
106 if (sz < min_sz || !is_power_of_2(sz)) {
107 pr_err(
"Invalid mmap size for ARM SPE: must be at least %zuKiB and a power of 2\n",
132 tracking_evsel->
attr.freq = 0;
133 tracking_evsel->
attr.sample_period = 1;
147 return ts.tv_sec ^ ts.tv_nsec;
200 struct perf_event_attr
203 struct perf_event_attr *
attr;
205 attr =
zalloc(
sizeof(
struct perf_event_attr));
207 pr_err(
"arm_spe default config cannot allocate a perf_event_attr\n");
216 &attr->sample_period) != 1) {
217 pr_debug(
"arm_spe driver doesn't advertise a min. interval. Using 4096\n");
218 attr->sample_period = 4096;
struct perf_evlist * evlist
static int arm_spe_read_finish(struct auxtrace_record *itr, int idx)
static u64 arm_spe_reference(struct auxtrace_record *itr __maybe_unused)
static void arm_spe_recording_free(struct auxtrace_record *itr)
int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,...)
size_t(* info_priv_size)(struct auxtrace_record *itr, struct perf_evlist *evlist)
#define perf_evsel__set_sample_bit(evsel, bit)
struct auxtrace_record * arm_spe_recording_init(int *err, struct perf_pmu *arm_spe_pmu)
static int arm_spe_info_fill(struct auxtrace_record *itr, struct perf_session *session, struct auxtrace_info_event *auxtrace_info, size_t priv_size)
int parse_events(struct perf_evlist *evlist, const char *str, struct parse_events_error *err)
void perf_evlist__set_tracking_event(struct perf_evlist *evlist, struct perf_evsel *tracking_evsel)
struct auxtrace_record itr
int(* read_finish)(struct auxtrace_record *itr, int idx)
u64(* reference)(struct auxtrace_record *itr)
#define pr_debug(fmt,...)
static struct perf_session * session
#define evlist__for_each_entry(evlist, evsel)
struct perf_evlist * evlist
void(* free)(struct auxtrace_record *itr)
struct perf_event_attr * arm_spe_pmu_default_config(struct perf_pmu *arm_spe_pmu)
int(* recording_options)(struct auxtrace_record *itr, struct perf_evlist *evlist, struct record_opts *opts)
#define CLOCK_MONOTONIC_RAW
void perf_evlist__to_front(struct perf_evlist *evlist, struct perf_evsel *move_evsel)
static int arm_spe_recording_options(struct auxtrace_record *itr, struct perf_evlist *evlist, struct record_opts *opts)
struct perf_pmu * arm_spe_pmu
int perf_event_paranoid(void)
#define ARM_SPE_AUXTRACE_PRIV_SIZE
static size_t arm_spe_info_priv_size(struct auxtrace_record *itr __maybe_unused, struct perf_evlist *evlist __maybe_unused)
#define perf_evsel__reset_sample_bit(evsel, bit)
static struct perf_evsel * perf_evlist__last(struct perf_evlist *evlist)
unsigned int auxtrace_mmap_pages
int(* info_fill)(struct auxtrace_record *itr, struct perf_session *session, struct auxtrace_info_event *auxtrace_info, size_t priv_size)
struct perf_event_attr attr
int perf_evlist__enable_event_idx(struct perf_evlist *evlist, struct perf_evsel *evsel, int idx)
void static void * zalloc(size_t size)