libperf: Add cpus to struct perf_evlist
Move cpus from tools/perf's evlist to libperf's perf_evlist struct. Committer notes: Fixed up this one: tools/perf/arch/arm/util/cs-etm.c Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Budankov <alexey.budankov@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20190721112506.12306-55-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ec903f264f
commit
f72f901d90
|
@ -155,7 +155,7 @@ static int cs_etm_set_option(struct auxtrace_record *itr,
|
||||||
struct evsel *evsel, u32 option)
|
struct evsel *evsel, u32 option)
|
||||||
{
|
{
|
||||||
int i, err = -EINVAL;
|
int i, err = -EINVAL;
|
||||||
struct perf_cpu_map *event_cpus = evsel->evlist->cpus;
|
struct perf_cpu_map *event_cpus = evsel->evlist->core.cpus;
|
||||||
struct perf_cpu_map *online_cpus = perf_cpu_map__new(NULL);
|
struct perf_cpu_map *online_cpus = perf_cpu_map__new(NULL);
|
||||||
|
|
||||||
/* Set option of each CPU we have */
|
/* Set option of each CPU we have */
|
||||||
|
@ -253,7 +253,7 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
|
||||||
container_of(itr, struct cs_etm_recording, itr);
|
container_of(itr, struct cs_etm_recording, itr);
|
||||||
struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu;
|
struct perf_pmu *cs_etm_pmu = ptr->cs_etm_pmu;
|
||||||
struct evsel *evsel, *cs_etm_evsel = NULL;
|
struct evsel *evsel, *cs_etm_evsel = NULL;
|
||||||
struct perf_cpu_map *cpus = evlist->cpus;
|
struct perf_cpu_map *cpus = evlist->core.cpus;
|
||||||
bool privileged = (geteuid() == 0 || perf_event_paranoid() < 0);
|
bool privileged = (geteuid() == 0 || perf_event_paranoid() < 0);
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int etmv3 = 0, etmv4 = 0;
|
int etmv3 = 0, etmv4 = 0;
|
||||||
struct perf_cpu_map *event_cpus = evlist->cpus;
|
struct perf_cpu_map *event_cpus = evlist->core.cpus;
|
||||||
struct perf_cpu_map *online_cpus = perf_cpu_map__new(NULL);
|
struct perf_cpu_map *online_cpus = perf_cpu_map__new(NULL);
|
||||||
|
|
||||||
/* cpu map is not empty, we have specific CPUs to work with */
|
/* cpu map is not empty, we have specific CPUs to work with */
|
||||||
|
@ -636,7 +636,7 @@ static int cs_etm_info_fill(struct auxtrace_record *itr,
|
||||||
u32 offset;
|
u32 offset;
|
||||||
u64 nr_cpu, type;
|
u64 nr_cpu, type;
|
||||||
struct perf_cpu_map *cpu_map;
|
struct perf_cpu_map *cpu_map;
|
||||||
struct perf_cpu_map *event_cpus = session->evlist->cpus;
|
struct perf_cpu_map *event_cpus = session->evlist->core.cpus;
|
||||||
struct perf_cpu_map *online_cpus = perf_cpu_map__new(NULL);
|
struct perf_cpu_map *online_cpus = perf_cpu_map__new(NULL);
|
||||||
struct cs_etm_recording *ptr =
|
struct cs_etm_recording *ptr =
|
||||||
container_of(itr, struct cs_etm_recording, itr);
|
container_of(itr, struct cs_etm_recording, itr);
|
||||||
|
|
|
@ -106,7 +106,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr,
|
||||||
container_of(itr, struct intel_bts_recording, itr);
|
container_of(itr, struct intel_bts_recording, itr);
|
||||||
struct perf_pmu *intel_bts_pmu = btsr->intel_bts_pmu;
|
struct perf_pmu *intel_bts_pmu = btsr->intel_bts_pmu;
|
||||||
struct evsel *evsel, *intel_bts_evsel = NULL;
|
struct evsel *evsel, *intel_bts_evsel = NULL;
|
||||||
const struct perf_cpu_map *cpus = evlist->cpus;
|
const struct perf_cpu_map *cpus = evlist->core.cpus;
|
||||||
bool privileged = geteuid() == 0 || perf_event_paranoid() < 0;
|
bool privileged = geteuid() == 0 || perf_event_paranoid() < 0;
|
||||||
|
|
||||||
btsr->evlist = evlist;
|
btsr->evlist = evlist;
|
||||||
|
|
|
@ -365,7 +365,7 @@ static int intel_pt_info_fill(struct auxtrace_record *itr,
|
||||||
ui__warning("Intel Processor Trace: TSC not available\n");
|
ui__warning("Intel Processor Trace: TSC not available\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
per_cpu_mmaps = !cpu_map__empty(session->evlist->cpus);
|
per_cpu_mmaps = !cpu_map__empty(session->evlist->core.cpus);
|
||||||
|
|
||||||
auxtrace_info->type = PERF_AUXTRACE_INTEL_PT;
|
auxtrace_info->type = PERF_AUXTRACE_INTEL_PT;
|
||||||
auxtrace_info->priv[INTEL_PT_PMU_TYPE] = intel_pt_pmu->type;
|
auxtrace_info->priv[INTEL_PT_PMU_TYPE] = intel_pt_pmu->type;
|
||||||
|
@ -557,7 +557,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
|
||||||
struct perf_pmu *intel_pt_pmu = ptr->intel_pt_pmu;
|
struct perf_pmu *intel_pt_pmu = ptr->intel_pt_pmu;
|
||||||
bool have_timing_info, need_immediate = false;
|
bool have_timing_info, need_immediate = false;
|
||||||
struct evsel *evsel, *intel_pt_evsel = NULL;
|
struct evsel *evsel, *intel_pt_evsel = NULL;
|
||||||
const struct perf_cpu_map *cpus = evlist->cpus;
|
const struct perf_cpu_map *cpus = evlist->core.cpus;
|
||||||
bool privileged = geteuid() == 0 || perf_event_paranoid() < 0;
|
bool privileged = geteuid() == 0 || perf_event_paranoid() < 0;
|
||||||
u64 tsc_bit;
|
u64 tsc_bit;
|
||||||
int err;
|
int err;
|
||||||
|
|
|
@ -192,7 +192,7 @@ static int set_tracing_cpumask(struct perf_cpu_map *cpumap)
|
||||||
|
|
||||||
static int set_tracing_cpu(struct perf_ftrace *ftrace)
|
static int set_tracing_cpu(struct perf_ftrace *ftrace)
|
||||||
{
|
{
|
||||||
struct perf_cpu_map *cpumap = ftrace->evlist->cpus;
|
struct perf_cpu_map *cpumap = ftrace->evlist->core.cpus;
|
||||||
|
|
||||||
if (!target__has_cpu(&ftrace->target))
|
if (!target__has_cpu(&ftrace->target))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1283,7 +1283,7 @@ static int record__synthesize(struct record *rec, bool tail)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = perf_event__synthesize_cpu_map(&rec->tool, rec->evlist->cpus,
|
err = perf_event__synthesize_cpu_map(&rec->tool, rec->evlist->core.cpus,
|
||||||
process_synthesized_event, NULL);
|
process_synthesized_event, NULL);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
pr_err("Couldn't synthesize cpu map.\n");
|
pr_err("Couldn't synthesize cpu map.\n");
|
||||||
|
|
|
@ -884,21 +884,21 @@ static int perf_stat_init_aggr_mode(void)
|
||||||
|
|
||||||
switch (stat_config.aggr_mode) {
|
switch (stat_config.aggr_mode) {
|
||||||
case AGGR_SOCKET:
|
case AGGR_SOCKET:
|
||||||
if (cpu_map__build_socket_map(evsel_list->cpus, &stat_config.aggr_map)) {
|
if (cpu_map__build_socket_map(evsel_list->core.cpus, &stat_config.aggr_map)) {
|
||||||
perror("cannot build socket map");
|
perror("cannot build socket map");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
stat_config.aggr_get_id = perf_stat__get_socket_cached;
|
stat_config.aggr_get_id = perf_stat__get_socket_cached;
|
||||||
break;
|
break;
|
||||||
case AGGR_DIE:
|
case AGGR_DIE:
|
||||||
if (cpu_map__build_die_map(evsel_list->cpus, &stat_config.aggr_map)) {
|
if (cpu_map__build_die_map(evsel_list->core.cpus, &stat_config.aggr_map)) {
|
||||||
perror("cannot build die map");
|
perror("cannot build die map");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
stat_config.aggr_get_id = perf_stat__get_die_cached;
|
stat_config.aggr_get_id = perf_stat__get_die_cached;
|
||||||
break;
|
break;
|
||||||
case AGGR_CORE:
|
case AGGR_CORE:
|
||||||
if (cpu_map__build_core_map(evsel_list->cpus, &stat_config.aggr_map)) {
|
if (cpu_map__build_core_map(evsel_list->core.cpus, &stat_config.aggr_map)) {
|
||||||
perror("cannot build core map");
|
perror("cannot build core map");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -906,7 +906,7 @@ static int perf_stat_init_aggr_mode(void)
|
||||||
break;
|
break;
|
||||||
case AGGR_NONE:
|
case AGGR_NONE:
|
||||||
if (term_percore_set()) {
|
if (term_percore_set()) {
|
||||||
if (cpu_map__build_core_map(evsel_list->cpus,
|
if (cpu_map__build_core_map(evsel_list->core.cpus,
|
||||||
&stat_config.aggr_map)) {
|
&stat_config.aggr_map)) {
|
||||||
perror("cannot build core map");
|
perror("cannot build core map");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -926,7 +926,7 @@ static int perf_stat_init_aggr_mode(void)
|
||||||
* taking the highest cpu number to be the size of
|
* taking the highest cpu number to be the size of
|
||||||
* the aggregation translate cpumap.
|
* the aggregation translate cpumap.
|
||||||
*/
|
*/
|
||||||
nr = cpu_map__get_max(evsel_list->cpus);
|
nr = cpu_map__get_max(evsel_list->core.cpus);
|
||||||
stat_config.cpus_aggr_map = cpu_map__empty_new(nr + 1);
|
stat_config.cpus_aggr_map = cpu_map__empty_new(nr + 1);
|
||||||
return stat_config.cpus_aggr_map ? 0 : -ENOMEM;
|
return stat_config.cpus_aggr_map ? 0 : -ENOMEM;
|
||||||
}
|
}
|
||||||
|
@ -1057,21 +1057,21 @@ static int perf_stat_init_aggr_mode_file(struct perf_stat *st)
|
||||||
|
|
||||||
switch (stat_config.aggr_mode) {
|
switch (stat_config.aggr_mode) {
|
||||||
case AGGR_SOCKET:
|
case AGGR_SOCKET:
|
||||||
if (perf_env__build_socket_map(env, evsel_list->cpus, &stat_config.aggr_map)) {
|
if (perf_env__build_socket_map(env, evsel_list->core.cpus, &stat_config.aggr_map)) {
|
||||||
perror("cannot build socket map");
|
perror("cannot build socket map");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
stat_config.aggr_get_id = perf_stat__get_socket_file;
|
stat_config.aggr_get_id = perf_stat__get_socket_file;
|
||||||
break;
|
break;
|
||||||
case AGGR_DIE:
|
case AGGR_DIE:
|
||||||
if (perf_env__build_die_map(env, evsel_list->cpus, &stat_config.aggr_map)) {
|
if (perf_env__build_die_map(env, evsel_list->core.cpus, &stat_config.aggr_map)) {
|
||||||
perror("cannot build die map");
|
perror("cannot build die map");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
stat_config.aggr_get_id = perf_stat__get_die_file;
|
stat_config.aggr_get_id = perf_stat__get_die_file;
|
||||||
break;
|
break;
|
||||||
case AGGR_CORE:
|
case AGGR_CORE:
|
||||||
if (perf_env__build_core_map(env, evsel_list->cpus, &stat_config.aggr_map)) {
|
if (perf_env__build_core_map(env, evsel_list->core.cpus, &stat_config.aggr_map)) {
|
||||||
perror("cannot build core map");
|
perror("cannot build core map");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -989,7 +989,7 @@ static int perf_top__start_counters(struct perf_top *top)
|
||||||
|
|
||||||
evlist__for_each_entry(evlist, counter) {
|
evlist__for_each_entry(evlist, counter) {
|
||||||
try_again:
|
try_again:
|
||||||
if (evsel__open(counter, top->evlist->cpus,
|
if (evsel__open(counter, top->evlist->core.cpus,
|
||||||
top->evlist->threads) < 0) {
|
top->evlist->threads) < 0) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
#ifndef __LIBPERF_INTERNAL_EVLIST_H
|
#ifndef __LIBPERF_INTERNAL_EVLIST_H
|
||||||
#define __LIBPERF_INTERNAL_EVLIST_H
|
#define __LIBPERF_INTERNAL_EVLIST_H
|
||||||
|
|
||||||
|
struct perf_cpu_map;
|
||||||
|
|
||||||
struct perf_evlist {
|
struct perf_evlist {
|
||||||
struct list_head entries;
|
struct list_head entries;
|
||||||
int nr_entries;
|
int nr_entries;
|
||||||
bool has_user_cpus;
|
bool has_user_cpus;
|
||||||
|
struct perf_cpu_map *cpus;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __LIBPERF_INTERNAL_EVLIST_H */
|
#endif /* __LIBPERF_INTERNAL_EVLIST_H */
|
||||||
|
|
|
@ -130,7 +130,7 @@ void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp,
|
||||||
mp->idx = idx;
|
mp->idx = idx;
|
||||||
|
|
||||||
if (per_cpu) {
|
if (per_cpu) {
|
||||||
mp->cpu = evlist->cpus->map[idx];
|
mp->cpu = evlist->core.cpus->map[idx];
|
||||||
if (evlist->threads)
|
if (evlist->threads)
|
||||||
mp->tid = thread_map__pid(evlist->threads, 0);
|
mp->tid = thread_map__pid(evlist->threads, 0);
|
||||||
else
|
else
|
||||||
|
|
|
@ -143,9 +143,9 @@ void evlist__delete(struct evlist *evlist)
|
||||||
|
|
||||||
perf_evlist__munmap(evlist);
|
perf_evlist__munmap(evlist);
|
||||||
evlist__close(evlist);
|
evlist__close(evlist);
|
||||||
perf_cpu_map__put(evlist->cpus);
|
perf_cpu_map__put(evlist->core.cpus);
|
||||||
perf_thread_map__put(evlist->threads);
|
perf_thread_map__put(evlist->threads);
|
||||||
evlist->cpus = NULL;
|
evlist->core.cpus = NULL;
|
||||||
evlist->threads = NULL;
|
evlist->threads = NULL;
|
||||||
perf_evlist__purge(evlist);
|
perf_evlist__purge(evlist);
|
||||||
perf_evlist__exit(evlist);
|
perf_evlist__exit(evlist);
|
||||||
|
@ -161,7 +161,7 @@ static void __perf_evlist__propagate_maps(struct evlist *evlist,
|
||||||
*/
|
*/
|
||||||
if (!evsel->core.own_cpus || evlist->core.has_user_cpus) {
|
if (!evsel->core.own_cpus || evlist->core.has_user_cpus) {
|
||||||
perf_cpu_map__put(evsel->core.cpus);
|
perf_cpu_map__put(evsel->core.cpus);
|
||||||
evsel->core.cpus = perf_cpu_map__get(evlist->cpus);
|
evsel->core.cpus = perf_cpu_map__get(evlist->core.cpus);
|
||||||
} else if (evsel->core.cpus != evsel->core.own_cpus) {
|
} else if (evsel->core.cpus != evsel->core.own_cpus) {
|
||||||
perf_cpu_map__put(evsel->core.cpus);
|
perf_cpu_map__put(evsel->core.cpus);
|
||||||
evsel->core.cpus = perf_cpu_map__get(evsel->core.own_cpus);
|
evsel->core.cpus = perf_cpu_map__get(evsel->core.own_cpus);
|
||||||
|
@ -398,7 +398,7 @@ static int perf_evlist__enable_event_thread(struct evlist *evlist,
|
||||||
int thread)
|
int thread)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
int nr_cpus = cpu_map__nr(evlist->cpus);
|
int nr_cpus = cpu_map__nr(evlist->core.cpus);
|
||||||
|
|
||||||
if (!evsel->fd)
|
if (!evsel->fd)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -414,7 +414,7 @@ static int perf_evlist__enable_event_thread(struct evlist *evlist,
|
||||||
int perf_evlist__enable_event_idx(struct evlist *evlist,
|
int perf_evlist__enable_event_idx(struct evlist *evlist,
|
||||||
struct evsel *evsel, int idx)
|
struct evsel *evsel, int idx)
|
||||||
{
|
{
|
||||||
bool per_cpu_mmaps = !cpu_map__empty(evlist->cpus);
|
bool per_cpu_mmaps = !cpu_map__empty(evlist->core.cpus);
|
||||||
|
|
||||||
if (per_cpu_mmaps)
|
if (per_cpu_mmaps)
|
||||||
return perf_evlist__enable_event_cpu(evlist, evsel, idx);
|
return perf_evlist__enable_event_cpu(evlist, evsel, idx);
|
||||||
|
@ -424,7 +424,7 @@ int perf_evlist__enable_event_idx(struct evlist *evlist,
|
||||||
|
|
||||||
int perf_evlist__alloc_pollfd(struct evlist *evlist)
|
int perf_evlist__alloc_pollfd(struct evlist *evlist)
|
||||||
{
|
{
|
||||||
int nr_cpus = cpu_map__nr(evlist->cpus);
|
int nr_cpus = cpu_map__nr(evlist->core.cpus);
|
||||||
int nr_threads = thread_map__nr(evlist->threads);
|
int nr_threads = thread_map__nr(evlist->threads);
|
||||||
int nfds = 0;
|
int nfds = 0;
|
||||||
struct evsel *evsel;
|
struct evsel *evsel;
|
||||||
|
@ -552,8 +552,8 @@ static void perf_evlist__set_sid_idx(struct evlist *evlist,
|
||||||
{
|
{
|
||||||
struct perf_sample_id *sid = SID(evsel, cpu, thread);
|
struct perf_sample_id *sid = SID(evsel, cpu, thread);
|
||||||
sid->idx = idx;
|
sid->idx = idx;
|
||||||
if (evlist->cpus && cpu >= 0)
|
if (evlist->core.cpus && cpu >= 0)
|
||||||
sid->cpu = evlist->cpus->map[cpu];
|
sid->cpu = evlist->core.cpus->map[cpu];
|
||||||
else
|
else
|
||||||
sid->cpu = -1;
|
sid->cpu = -1;
|
||||||
if (!evsel->system_wide && evlist->threads && thread >= 0)
|
if (!evsel->system_wide && evlist->threads && thread >= 0)
|
||||||
|
@ -720,8 +720,8 @@ static struct perf_mmap *perf_evlist__alloc_mmap(struct evlist *evlist,
|
||||||
int i;
|
int i;
|
||||||
struct perf_mmap *map;
|
struct perf_mmap *map;
|
||||||
|
|
||||||
evlist->nr_mmaps = cpu_map__nr(evlist->cpus);
|
evlist->nr_mmaps = cpu_map__nr(evlist->core.cpus);
|
||||||
if (cpu_map__empty(evlist->cpus))
|
if (cpu_map__empty(evlist->core.cpus))
|
||||||
evlist->nr_mmaps = thread_map__nr(evlist->threads);
|
evlist->nr_mmaps = thread_map__nr(evlist->threads);
|
||||||
map = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap));
|
map = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap));
|
||||||
if (!map)
|
if (!map)
|
||||||
|
@ -759,7 +759,7 @@ static int perf_evlist__mmap_per_evsel(struct evlist *evlist, int idx,
|
||||||
{
|
{
|
||||||
struct evsel *evsel;
|
struct evsel *evsel;
|
||||||
int revent;
|
int revent;
|
||||||
int evlist_cpu = cpu_map__cpu(evlist->cpus, cpu_idx);
|
int evlist_cpu = cpu_map__cpu(evlist->core.cpus, cpu_idx);
|
||||||
|
|
||||||
evlist__for_each_entry(evlist, evsel) {
|
evlist__for_each_entry(evlist, evsel) {
|
||||||
struct perf_mmap *maps = evlist->mmap;
|
struct perf_mmap *maps = evlist->mmap;
|
||||||
|
@ -835,7 +835,7 @@ static int perf_evlist__mmap_per_cpu(struct evlist *evlist,
|
||||||
struct mmap_params *mp)
|
struct mmap_params *mp)
|
||||||
{
|
{
|
||||||
int cpu, thread;
|
int cpu, thread;
|
||||||
int nr_cpus = cpu_map__nr(evlist->cpus);
|
int nr_cpus = cpu_map__nr(evlist->core.cpus);
|
||||||
int nr_threads = thread_map__nr(evlist->threads);
|
int nr_threads = thread_map__nr(evlist->threads);
|
||||||
|
|
||||||
pr_debug2("perf event ring buffer mmapped per cpu\n");
|
pr_debug2("perf event ring buffer mmapped per cpu\n");
|
||||||
|
@ -1014,7 +1014,7 @@ int perf_evlist__mmap_ex(struct evlist *evlist, unsigned int pages,
|
||||||
int comp_level)
|
int comp_level)
|
||||||
{
|
{
|
||||||
struct evsel *evsel;
|
struct evsel *evsel;
|
||||||
const struct perf_cpu_map *cpus = evlist->cpus;
|
const struct perf_cpu_map *cpus = evlist->core.cpus;
|
||||||
const struct perf_thread_map *threads = evlist->threads;
|
const struct perf_thread_map *threads = evlist->threads;
|
||||||
/*
|
/*
|
||||||
* Delay setting mp.prot: set it before calling perf_mmap__mmap.
|
* Delay setting mp.prot: set it before calling perf_mmap__mmap.
|
||||||
|
@ -1116,9 +1116,9 @@ void perf_evlist__set_maps(struct evlist *evlist, struct perf_cpu_map *cpus,
|
||||||
* original reference count of 1. If that is not the case it is up to
|
* original reference count of 1. If that is not the case it is up to
|
||||||
* the caller to increase the reference count.
|
* the caller to increase the reference count.
|
||||||
*/
|
*/
|
||||||
if (cpus != evlist->cpus) {
|
if (cpus != evlist->core.cpus) {
|
||||||
perf_cpu_map__put(evlist->cpus);
|
perf_cpu_map__put(evlist->core.cpus);
|
||||||
evlist->cpus = perf_cpu_map__get(cpus);
|
evlist->core.cpus = perf_cpu_map__get(cpus);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (threads != evlist->threads) {
|
if (threads != evlist->threads) {
|
||||||
|
@ -1398,7 +1398,7 @@ int evlist__open(struct evlist *evlist)
|
||||||
* Default: one fd per CPU, all threads, aka systemwide
|
* Default: one fd per CPU, all threads, aka systemwide
|
||||||
* as sys_perf_event_open(cpu = -1, thread = -1) is EINVAL
|
* as sys_perf_event_open(cpu = -1, thread = -1) is EINVAL
|
||||||
*/
|
*/
|
||||||
if (evlist->threads == NULL && evlist->cpus == NULL) {
|
if (evlist->threads == NULL && evlist->core.cpus == NULL) {
|
||||||
err = perf_evlist__create_syswide_maps(evlist);
|
err = perf_evlist__create_syswide_maps(evlist);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
@ -1920,7 +1920,7 @@ int perf_evlist__start_sb_thread(struct evlist *evlist,
|
||||||
goto out_delete_evlist;
|
goto out_delete_evlist;
|
||||||
|
|
||||||
evlist__for_each_entry(evlist, counter) {
|
evlist__for_each_entry(evlist, counter) {
|
||||||
if (evsel__open(counter, evlist->cpus,
|
if (evsel__open(counter, evlist->core.cpus,
|
||||||
evlist->threads) < 0)
|
evlist->threads) < 0)
|
||||||
goto out_delete_evlist;
|
goto out_delete_evlist;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ struct evlist {
|
||||||
struct perf_mmap *mmap;
|
struct perf_mmap *mmap;
|
||||||
struct perf_mmap *overwrite_mmap;
|
struct perf_mmap *overwrite_mmap;
|
||||||
struct perf_thread_map *threads;
|
struct perf_thread_map *threads;
|
||||||
struct perf_cpu_map *cpus;
|
|
||||||
struct evsel *selected;
|
struct evsel *selected;
|
||||||
struct events_stats stats;
|
struct events_stats stats;
|
||||||
struct perf_env *env;
|
struct perf_env *env;
|
||||||
|
|
|
@ -148,7 +148,7 @@ void perf_evlist__config(struct evlist *evlist, struct record_opts *opts,
|
||||||
if (opts->group)
|
if (opts->group)
|
||||||
perf_evlist__set_leader(evlist);
|
perf_evlist__set_leader(evlist);
|
||||||
|
|
||||||
if (evlist->cpus->map[0] < 0)
|
if (evlist->core.cpus->map[0] < 0)
|
||||||
opts->no_inherit = true;
|
opts->no_inherit = true;
|
||||||
|
|
||||||
use_comm_exec = perf_can_comm_exec();
|
use_comm_exec = perf_can_comm_exec();
|
||||||
|
@ -275,13 +275,13 @@ bool perf_evlist__can_select_event(struct evlist *evlist, const char *str)
|
||||||
|
|
||||||
evsel = perf_evlist__last(temp_evlist);
|
evsel = perf_evlist__last(temp_evlist);
|
||||||
|
|
||||||
if (!evlist || cpu_map__empty(evlist->cpus)) {
|
if (!evlist || cpu_map__empty(evlist->core.cpus)) {
|
||||||
struct perf_cpu_map *cpus = perf_cpu_map__new(NULL);
|
struct perf_cpu_map *cpus = perf_cpu_map__new(NULL);
|
||||||
|
|
||||||
cpu = cpus ? cpus->map[0] : 0;
|
cpu = cpus ? cpus->map[0] : 0;
|
||||||
perf_cpu_map__put(cpus);
|
perf_cpu_map__put(cpus);
|
||||||
} else {
|
} else {
|
||||||
cpu = evlist->cpus->map[0];
|
cpu = evlist->core.cpus->map[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
|
@ -327,7 +327,7 @@ static int first_shadow_cpu(struct perf_stat_config *config,
|
||||||
for (i = 0; i < perf_evsel__nr_cpus(evsel); i++) {
|
for (i = 0; i < perf_evsel__nr_cpus(evsel); i++) {
|
||||||
int cpu2 = evsel__cpus(evsel)->map[i];
|
int cpu2 = evsel__cpus(evsel)->map[i];
|
||||||
|
|
||||||
if (config->aggr_get_id(config, evlist->cpus, cpu2) == id)
|
if (config->aggr_get_id(config, evlist->core.cpus, cpu2) == id)
|
||||||
return cpu2;
|
return cpu2;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -500,7 +500,7 @@ static void aggr_update_shadow(struct perf_stat_config *config,
|
||||||
evlist__for_each_entry(evlist, counter) {
|
evlist__for_each_entry(evlist, counter) {
|
||||||
val = 0;
|
val = 0;
|
||||||
for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) {
|
for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) {
|
||||||
s2 = config->aggr_get_id(config, evlist->cpus, cpu);
|
s2 = config->aggr_get_id(config, evlist->core.cpus, cpu);
|
||||||
if (s2 != id)
|
if (s2 != id)
|
||||||
continue;
|
continue;
|
||||||
val += perf_counts(counter->counts, cpu, 0)->val;
|
val += perf_counts(counter->counts, cpu, 0)->val;
|
||||||
|
@ -868,7 +868,7 @@ static void print_no_aggr_metric(struct perf_stat_config *config,
|
||||||
u64 ena, run, val;
|
u64 ena, run, val;
|
||||||
double uval;
|
double uval;
|
||||||
|
|
||||||
nrcpus = evlist->cpus->nr;
|
nrcpus = evlist->core.cpus->nr;
|
||||||
for (cpu = 0; cpu < nrcpus; cpu++) {
|
for (cpu = 0; cpu < nrcpus; cpu++) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
|
|
|
@ -514,7 +514,7 @@ int perf_stat_synthesize_config(struct perf_stat_config *config,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = perf_event__synthesize_cpu_map(tool, evlist->cpus,
|
err = perf_event__synthesize_cpu_map(tool, evlist->core.cpus,
|
||||||
process, NULL);
|
process, NULL);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
pr_err("Couldn't synthesize thread map.\n");
|
pr_err("Couldn't synthesize thread map.\n");
|
||||||
|
|
|
@ -95,15 +95,15 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size)
|
||||||
|
|
||||||
if (target->cpu_list)
|
if (target->cpu_list)
|
||||||
ret += SNPRINTF(bf + ret, size - ret, ", CPU%s: %s)",
|
ret += SNPRINTF(bf + ret, size - ret, ", CPU%s: %s)",
|
||||||
top->evlist->cpus->nr > 1 ? "s" : "",
|
top->evlist->core.cpus->nr > 1 ? "s" : "",
|
||||||
target->cpu_list);
|
target->cpu_list);
|
||||||
else {
|
else {
|
||||||
if (target->tid)
|
if (target->tid)
|
||||||
ret += SNPRINTF(bf + ret, size - ret, ")");
|
ret += SNPRINTF(bf + ret, size - ret, ")");
|
||||||
else
|
else
|
||||||
ret += SNPRINTF(bf + ret, size - ret, ", %d CPU%s)",
|
ret += SNPRINTF(bf + ret, size - ret, ", %d CPU%s)",
|
||||||
top->evlist->cpus->nr,
|
top->evlist->core.cpus->nr,
|
||||||
top->evlist->cpus->nr > 1 ? "s" : "");
|
top->evlist->core.cpus->nr > 1 ? "s" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
perf_top__reset_sample_counters(top);
|
perf_top__reset_sample_counters(top);
|
||||||
|
|
Loading…
Reference in New Issue