diff options
Diffstat (limited to 'tools/perf/arch/x86/util/intel-bts.c')
-rw-r--r-- | tools/perf/arch/x86/util/intel-bts.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c index ec5c1bb84095..d263430c045f 100644 --- a/tools/perf/arch/x86/util/intel-bts.c +++ b/tools/perf/arch/x86/util/intel-bts.c @@ -12,14 +12,17 @@ #include <linux/zalloc.h> #include "../../util/cpumap.h" +#include "../../util/event.h" #include "../../util/evsel.h" #include "../../util/evlist.h" #include "../../util/session.h" #include "../../util/pmu.h" #include "../../util/debug.h" +#include "../../util/record.h" #include "../../util/tsc.h" #include "../../util/auxtrace.h" #include "../../util/intel-bts.h" +#include "../../util/util.h" #define KiB(x) ((x) * 1024) #define MiB(x) ((x) * 1024 * 1024) @@ -35,7 +38,7 @@ struct intel_bts_snapshot_ref { struct intel_bts_recording { struct auxtrace_record itr; struct perf_pmu *intel_bts_pmu; - struct perf_evlist *evlist; + struct evlist *evlist; bool snapshot_mode; size_t snapshot_size; int snapshot_ref_cnt; @@ -50,14 +53,14 @@ struct branch { static size_t intel_bts_info_priv_size(struct auxtrace_record *itr __maybe_unused, - struct perf_evlist *evlist __maybe_unused) + struct evlist *evlist __maybe_unused) { return INTEL_BTS_AUXTRACE_PRIV_SIZE; } static int intel_bts_info_fill(struct auxtrace_record *itr, struct perf_session *session, - struct auxtrace_info_event *auxtrace_info, + struct perf_record_auxtrace_info *auxtrace_info, size_t priv_size) { struct intel_bts_recording *btsr = @@ -99,27 +102,27 @@ static int intel_bts_info_fill(struct auxtrace_record *itr, } static int intel_bts_recording_options(struct auxtrace_record *itr, - struct perf_evlist *evlist, + struct evlist *evlist, struct record_opts *opts) { struct intel_bts_recording *btsr = container_of(itr, struct intel_bts_recording, itr); struct perf_pmu *intel_bts_pmu = btsr->intel_bts_pmu; - struct perf_evsel *evsel, *intel_bts_evsel = NULL; - const struct cpu_map *cpus = evlist->cpus; - bool privileged = geteuid() == 0 || perf_event_paranoid() < 0; + struct evsel *evsel, *intel_bts_evsel = NULL; + const struct perf_cpu_map *cpus = evlist->core.cpus; + bool privileged = perf_event_paranoid_check(-1); btsr->evlist = evlist; btsr->snapshot_mode = opts->auxtrace_snapshot_mode; evlist__for_each_entry(evlist, evsel) { - if (evsel->attr.type == intel_bts_pmu->type) { + if (evsel->core.attr.type == intel_bts_pmu->type) { if (intel_bts_evsel) { pr_err("There may be only one " INTEL_BTS_PMU_NAME " event\n"); return -EINVAL; } - evsel->attr.freq = 0; - evsel->attr.sample_period = 1; + evsel->core.attr.freq = 0; + evsel->core.attr.sample_period = 1; intel_bts_evsel = evsel; opts->full_auxtrace = true; } @@ -133,7 +136,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr, if (!opts->full_auxtrace) return 0; - if (opts->full_auxtrace && !cpu_map__empty(cpus)) { + if (opts->full_auxtrace && !perf_cpu_map__empty(cpus)) { pr_err(INTEL_BTS_PMU_NAME " does not support per-cpu recording\n"); return -EINVAL; } @@ -214,13 +217,13 @@ static int intel_bts_recording_options(struct auxtrace_record *itr, * In the case of per-cpu mmaps, we need the CPU on the * AUX event. */ - if (!cpu_map__empty(cpus)) + if (!perf_cpu_map__empty(cpus)) perf_evsel__set_sample_bit(intel_bts_evsel, CPU); } /* Add dummy event to keep tracking */ if (opts->full_auxtrace) { - struct perf_evsel *tracking_evsel; + struct evsel *tracking_evsel; int err; err = parse_events(evlist, "dummy:u", NULL); @@ -231,8 +234,8 @@ static int intel_bts_recording_options(struct auxtrace_record *itr, perf_evlist__set_tracking_event(evlist, tracking_evsel); - tracking_evsel->attr.freq = 0; - tracking_evsel->attr.sample_period = 1; + tracking_evsel->core.attr.freq = 0; + tracking_evsel->core.attr.sample_period = 1; } return 0; @@ -313,11 +316,11 @@ static int intel_bts_snapshot_start(struct auxtrace_record *itr) { struct intel_bts_recording *btsr = container_of(itr, struct intel_bts_recording, itr); - struct perf_evsel *evsel; + struct evsel *evsel; evlist__for_each_entry(btsr->evlist, evsel) { - if (evsel->attr.type == btsr->intel_bts_pmu->type) - return perf_evsel__disable(evsel); + if (evsel->core.attr.type == btsr->intel_bts_pmu->type) + return evsel__disable(evsel); } return -EINVAL; } @@ -326,11 +329,11 @@ static int intel_bts_snapshot_finish(struct auxtrace_record *itr) { struct intel_bts_recording *btsr = container_of(itr, struct intel_bts_recording, itr); - struct perf_evsel *evsel; + struct evsel *evsel; evlist__for_each_entry(btsr->evlist, evsel) { - if (evsel->attr.type == btsr->intel_bts_pmu->type) - return perf_evsel__enable(evsel); + if (evsel->core.attr.type == btsr->intel_bts_pmu->type) + return evsel__enable(evsel); } return -EINVAL; } @@ -408,10 +411,10 @@ static int intel_bts_read_finish(struct auxtrace_record *itr, int idx) { struct intel_bts_recording *btsr = container_of(itr, struct intel_bts_recording, itr); - struct perf_evsel *evsel; + struct evsel *evsel; evlist__for_each_entry(btsr->evlist, evsel) { - if (evsel->attr.type == btsr->intel_bts_pmu->type) + if (evsel->core.attr.type == btsr->intel_bts_pmu->type) return perf_evlist__enable_event_idx(btsr->evlist, evsel, idx); } |