aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/evlist.c')
-rw-r--r--tools/perf/util/evlist.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 186b87730396..705293489e3c 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -52,15 +52,13 @@ struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
52void perf_evlist__config_attrs(struct perf_evlist *evlist, 52void perf_evlist__config_attrs(struct perf_evlist *evlist,
53 struct perf_record_opts *opts) 53 struct perf_record_opts *opts)
54{ 54{
55 struct perf_evsel *evsel, *first; 55 struct perf_evsel *evsel;
56 56
57 if (evlist->cpus->map[0] < 0) 57 if (evlist->cpus->map[0] < 0)
58 opts->no_inherit = true; 58 opts->no_inherit = true;
59 59
60 first = perf_evlist__first(evlist);
61
62 list_for_each_entry(evsel, &evlist->entries, node) { 60 list_for_each_entry(evsel, &evlist->entries, node) {
63 perf_evsel__config(evsel, opts, first); 61 perf_evsel__config(evsel, opts);
64 62
65 if (evlist->nr_entries > 1) 63 if (evlist->nr_entries > 1)
66 evsel->attr.sample_type |= PERF_SAMPLE_ID; 64 evsel->attr.sample_type |= PERF_SAMPLE_ID;
@@ -224,6 +222,8 @@ void perf_evlist__disable(struct perf_evlist *evlist)
224 222
225 for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { 223 for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {
226 list_for_each_entry(pos, &evlist->entries, node) { 224 list_for_each_entry(pos, &evlist->entries, node) {
225 if (perf_evsel__is_group_member(pos))
226 continue;
227 for (thread = 0; thread < evlist->threads->nr; thread++) 227 for (thread = 0; thread < evlist->threads->nr; thread++)
228 ioctl(FD(pos, cpu, thread), 228 ioctl(FD(pos, cpu, thread),
229 PERF_EVENT_IOC_DISABLE, 0); 229 PERF_EVENT_IOC_DISABLE, 0);
@@ -238,6 +238,8 @@ void perf_evlist__enable(struct perf_evlist *evlist)
238 238
239 for (cpu = 0; cpu < cpu_map__nr(evlist->cpus); cpu++) { 239 for (cpu = 0; cpu < cpu_map__nr(evlist->cpus); cpu++) {
240 list_for_each_entry(pos, &evlist->entries, node) { 240 list_for_each_entry(pos, &evlist->entries, node) {
241 if (perf_evsel__is_group_member(pos))
242 continue;
241 for (thread = 0; thread < evlist->threads->nr; thread++) 243 for (thread = 0; thread < evlist->threads->nr; thread++)
242 ioctl(FD(pos, cpu, thread), 244 ioctl(FD(pos, cpu, thread),
243 PERF_EVENT_IOC_ENABLE, 0); 245 PERF_EVENT_IOC_ENABLE, 0);
@@ -325,8 +327,6 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
325 327
326union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx) 328union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
327{ 329{
328 /* XXX Move this to perf.c, making it generally available */
329 unsigned int page_size = sysconf(_SC_PAGE_SIZE);
330 struct perf_mmap *md = &evlist->mmap[idx]; 330 struct perf_mmap *md = &evlist->mmap[idx];
331 unsigned int head = perf_mmap__read_head(md); 331 unsigned int head = perf_mmap__read_head(md);
332 unsigned int old = md->prev; 332 unsigned int old = md->prev;
@@ -528,7 +528,6 @@ out_unmap:
528int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages, 528int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
529 bool overwrite) 529 bool overwrite)
530{ 530{
531 unsigned int page_size = sysconf(_SC_PAGE_SIZE);
532 struct perf_evsel *evsel; 531 struct perf_evsel *evsel;
533 const struct cpu_map *cpus = evlist->cpus; 532 const struct cpu_map *cpus = evlist->cpus;
534 const struct thread_map *threads = evlist->threads; 533 const struct thread_map *threads = evlist->threads;