libperf: Add cpus to struct perf_evsel
Mov the 'cpus' field from tools/perf's evsel to libperf's perf_evsel. 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-51-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
b9358ee95e
commit
d400bd3abf
@@ -160,11 +160,11 @@ static void __perf_evlist__propagate_maps(struct evlist *evlist,
|
||||
* keep it, if there's no target cpu list defined.
|
||||
*/
|
||||
if (!evsel->own_cpus || evlist->has_user_cpus) {
|
||||
perf_cpu_map__put(evsel->cpus);
|
||||
evsel->cpus = perf_cpu_map__get(evlist->cpus);
|
||||
} else if (evsel->cpus != evsel->own_cpus) {
|
||||
perf_cpu_map__put(evsel->cpus);
|
||||
evsel->cpus = perf_cpu_map__get(evsel->own_cpus);
|
||||
perf_cpu_map__put(evsel->core.cpus);
|
||||
evsel->core.cpus = perf_cpu_map__get(evlist->cpus);
|
||||
} else if (evsel->core.cpus != evsel->own_cpus) {
|
||||
perf_cpu_map__put(evsel->core.cpus);
|
||||
evsel->core.cpus = perf_cpu_map__get(evsel->own_cpus);
|
||||
}
|
||||
|
||||
perf_thread_map__put(evsel->threads);
|
||||
@@ -786,7 +786,7 @@ static int perf_evlist__mmap_per_evsel(struct evlist *evlist, int idx,
|
||||
if (evsel->system_wide && thread)
|
||||
continue;
|
||||
|
||||
cpu = cpu_map__idx(evsel->cpus, evlist_cpu);
|
||||
cpu = cpu_map__idx(evsel->core.cpus, evlist_cpu);
|
||||
if (cpu == -1)
|
||||
continue;
|
||||
|
||||
@@ -1407,7 +1407,7 @@ int evlist__open(struct evlist *evlist)
|
||||
perf_evlist__update_id_pos(evlist);
|
||||
|
||||
evlist__for_each_entry(evlist, evsel) {
|
||||
err = evsel__open(evsel, evsel->cpus, evsel->threads);
|
||||
err = evsel__open(evsel, evsel->core.cpus, evsel->threads);
|
||||
if (err < 0)
|
||||
goto out_err;
|
||||
}
|
||||
|
@@ -1325,7 +1325,7 @@ void perf_evsel__exit(struct evsel *evsel)
|
||||
perf_evsel__free_id(evsel);
|
||||
perf_evsel__free_config_terms(evsel);
|
||||
cgroup__put(evsel->cgrp);
|
||||
perf_cpu_map__put(evsel->cpus);
|
||||
perf_cpu_map__put(evsel->core.cpus);
|
||||
perf_cpu_map__put(evsel->own_cpus);
|
||||
perf_thread_map__put(evsel->threads);
|
||||
zfree(&evsel->group_name);
|
||||
@@ -3064,7 +3064,7 @@ static int store_evsel_ids(struct evsel *evsel, struct evlist *evlist)
|
||||
|
||||
int perf_evsel__store_ids(struct evsel *evsel, struct evlist *evlist)
|
||||
{
|
||||
struct perf_cpu_map *cpus = evsel->cpus;
|
||||
struct perf_cpu_map *cpus = evsel->core.cpus;
|
||||
struct perf_thread_map *threads = evsel->threads;
|
||||
|
||||
if (perf_evsel__alloc_id(evsel, cpus->nr, threads->nr))
|
||||
|
@@ -123,7 +123,6 @@ struct evsel {
|
||||
u64 db_id;
|
||||
struct cgroup *cgrp;
|
||||
void *handler;
|
||||
struct perf_cpu_map *cpus;
|
||||
struct perf_cpu_map *own_cpus;
|
||||
struct perf_thread_map *threads;
|
||||
unsigned int sample_size;
|
||||
@@ -198,7 +197,7 @@ struct record_opts;
|
||||
|
||||
static inline struct perf_cpu_map *evsel__cpus(struct evsel *evsel)
|
||||
{
|
||||
return evsel->cpus;
|
||||
return evsel->core.cpus;
|
||||
}
|
||||
|
||||
static inline int perf_evsel__nr_cpus(struct evsel *evsel)
|
||||
|
@@ -333,7 +333,7 @@ __add_event(struct list_head *list, int *idx,
|
||||
return NULL;
|
||||
|
||||
(*idx)++;
|
||||
evsel->cpus = perf_cpu_map__get(cpus);
|
||||
evsel->core.cpus = perf_cpu_map__get(cpus);
|
||||
evsel->own_cpus = perf_cpu_map__get(cpus);
|
||||
evsel->system_wide = pmu ? pmu->is_uncore : false;
|
||||
evsel->auto_merge_stats = auto_merge_stats;
|
||||
|
@@ -1393,7 +1393,7 @@ static void python_process_stat(struct perf_stat_config *config,
|
||||
struct evsel *counter, u64 tstamp)
|
||||
{
|
||||
struct perf_thread_map *threads = counter->threads;
|
||||
struct perf_cpu_map *cpus = counter->cpus;
|
||||
struct perf_cpu_map *cpus = counter->core.cpus;
|
||||
int cpu, thread;
|
||||
|
||||
if (config->aggr_mode == AGGR_GLOBAL) {
|
||||
|
@@ -745,7 +745,7 @@ static void print_aggr_thread(struct perf_stat_config *config,
|
||||
{
|
||||
FILE *output = config->output;
|
||||
int nthreads = thread_map__nr(counter->threads);
|
||||
int ncpus = cpu_map__nr(counter->cpus);
|
||||
int ncpus = cpu_map__nr(counter->core.cpus);
|
||||
int thread, sorted_threads, id;
|
||||
struct perf_aggr_thread_value *buf;
|
||||
|
||||
|
Reference in New Issue
Block a user