libperf: Move 'system_wide' from 'struct evsel' to 'struct perf_evsel'
Move the 'system_wide 'member from perf's evsel to libperf's perf_evsel. Committer notes: Added stdbool.h as we now use bool here. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lore.kernel.org/lkml/20190913132355.21634-20-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
65aa2e6bae
commit
648b5af3f3
@@ -319,7 +319,7 @@ int perf_evlist__add_newtp(struct evlist *evlist,
|
||||
static int perf_evlist__nr_threads(struct evlist *evlist,
|
||||
struct evsel *evsel)
|
||||
{
|
||||
if (evsel->system_wide)
|
||||
if (evsel->core.system_wide)
|
||||
return 1;
|
||||
else
|
||||
return perf_thread_map__nr(evlist->core.threads);
|
||||
@@ -410,7 +410,7 @@ int perf_evlist__alloc_pollfd(struct evlist *evlist)
|
||||
struct evsel *evsel;
|
||||
|
||||
evlist__for_each_entry(evlist, evsel) {
|
||||
if (evsel->system_wide)
|
||||
if (evsel->core.system_wide)
|
||||
nfds += nr_cpus;
|
||||
else
|
||||
nfds += nr_cpus * nr_threads;
|
||||
@@ -536,7 +536,7 @@ static void perf_evlist__set_sid_idx(struct evlist *evlist,
|
||||
sid->cpu = evlist->core.cpus->map[cpu];
|
||||
else
|
||||
sid->cpu = -1;
|
||||
if (!evsel->system_wide && evlist->core.threads && thread >= 0)
|
||||
if (!evsel->core.system_wide && evlist->core.threads && thread >= 0)
|
||||
sid->tid = perf_thread_map__pid(evlist->core.threads, thread);
|
||||
else
|
||||
sid->tid = -1;
|
||||
@@ -763,7 +763,7 @@ static int evlist__mmap_per_evsel(struct evlist *evlist, int idx,
|
||||
mp->prot &= ~PROT_WRITE;
|
||||
}
|
||||
|
||||
if (evsel->system_wide && thread)
|
||||
if (evsel->core.system_wide && thread)
|
||||
continue;
|
||||
|
||||
cpu = perf_cpu_map__idx(evsel->core.cpus, evlist_cpu);
|
||||
@@ -793,7 +793,7 @@ static int evlist__mmap_per_evsel(struct evlist *evlist, int idx,
|
||||
* other events, so it should not need to be polled anyway.
|
||||
* Therefore don't add it for polling.
|
||||
*/
|
||||
if (!evsel->system_wide &&
|
||||
if (!evsel->core.system_wide &&
|
||||
__perf_evlist__add_pollfd(evlist, fd, &maps[idx], revent) < 0) {
|
||||
perf_mmap__put(&maps[idx]);
|
||||
return -1;
|
||||
|
@@ -1232,7 +1232,7 @@ int perf_evsel__alloc_id(struct evsel *evsel, int ncpus, int nthreads)
|
||||
if (ncpus == 0 || nthreads == 0)
|
||||
return 0;
|
||||
|
||||
if (evsel->system_wide)
|
||||
if (evsel->core.system_wide)
|
||||
nthreads = 1;
|
||||
|
||||
evsel->sample_id = xyarray__new(ncpus, nthreads, sizeof(struct perf_sample_id));
|
||||
@@ -1663,7 +1663,7 @@ static bool ignore_missing_thread(struct evsel *evsel,
|
||||
return false;
|
||||
|
||||
/* The system wide setup does not work with threads. */
|
||||
if (evsel->system_wide)
|
||||
if (evsel->core.system_wide)
|
||||
return false;
|
||||
|
||||
/* The -ESRCH is perf event syscall errno for pid's not found. */
|
||||
@@ -1772,7 +1772,7 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
|
||||
threads = empty_thread_map;
|
||||
}
|
||||
|
||||
if (evsel->system_wide)
|
||||
if (evsel->core.system_wide)
|
||||
nthreads = 1;
|
||||
else
|
||||
nthreads = threads->nr;
|
||||
@@ -1819,7 +1819,7 @@ retry_sample_id:
|
||||
for (thread = 0; thread < nthreads; thread++) {
|
||||
int fd, group_fd;
|
||||
|
||||
if (!evsel->cgrp && !evsel->system_wide)
|
||||
if (!evsel->cgrp && !evsel->core.system_wide)
|
||||
pid = perf_thread_map__pid(threads, thread);
|
||||
|
||||
group_fd = get_group_fd(evsel, cpu, thread);
|
||||
|
@@ -146,7 +146,6 @@ struct evsel {
|
||||
bool disabled;
|
||||
bool no_aux_samples;
|
||||
bool immediate;
|
||||
bool system_wide;
|
||||
bool tracking;
|
||||
bool per_pkg;
|
||||
bool precise_max;
|
||||
|
@@ -335,7 +335,7 @@ __add_event(struct list_head *list, int *idx,
|
||||
(*idx)++;
|
||||
evsel->core.cpus = perf_cpu_map__get(cpus);
|
||||
evsel->core.own_cpus = perf_cpu_map__get(cpus);
|
||||
evsel->system_wide = pmu ? pmu->is_uncore : false;
|
||||
evsel->core.system_wide = pmu ? pmu->is_uncore : false;
|
||||
evsel->auto_merge_stats = auto_merge_stats;
|
||||
|
||||
if (name)
|
||||
|
@@ -336,7 +336,7 @@ static int process_counter_maps(struct perf_stat_config *config,
|
||||
int ncpus = perf_evsel__nr_cpus(counter);
|
||||
int cpu, thread;
|
||||
|
||||
if (counter->system_wide)
|
||||
if (counter->core.system_wide)
|
||||
nthreads = 1;
|
||||
|
||||
for (thread = 0; thread < nthreads; thread++) {
|
||||
|
Reference in New Issue
Block a user