aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evlist.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-01-30 08:59:43 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-01-31 09:40:52 -0500
commit7e2ed097538c57ff5268e9a6bced7c0b885809c8 (patch)
tree44f9998cc6054d5bef07d6c2979afb0e81ddf13c /tools/perf/util/evlist.h
parentf8a9530939ed87b9a1b1a038b90e355098b679a2 (diff)
perf evlist: Store pointer to the cpu and thread maps
So that we don't have to pass it around to the several methods that needs it, simplifying usage. There is one case where we don't have the thread/cpu map in advance, which is in the parsing routines used by top, stat, record, that we have to wait till all options are parsed to know if a cpu or thread list was passed to then create those maps. For that case consolidate the cpu and thread map creation via perf_evlist__create_maps() out of the code in top and record, while also providing a perf_evlist__set_maps() for cases where multiple evlists share maps or for when maps that represent CPU sockets, for instance, get crafted out of topology information or subsets of threads in a particular application are to be monitored, providing more granularity in specifying which cpus and threads to monitor. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evlist.h')
-rw-r--r--tools/perf/util/evlist.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 85aca6eba16b..c9884056097c 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -22,28 +22,43 @@ struct perf_evlist {
22 union perf_event event_copy; 22 union perf_event event_copy;
23 struct perf_mmap *mmap; 23 struct perf_mmap *mmap;
24 struct pollfd *pollfd; 24 struct pollfd *pollfd;
25 struct thread_map *threads;
26 struct cpu_map *cpus;
25}; 27};
26 28
27struct perf_evsel; 29struct perf_evsel;
28 30
29struct perf_evlist *perf_evlist__new(void); 31struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
30void perf_evlist__init(struct perf_evlist *evlist); 32 struct thread_map *threads);
33void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
34 struct thread_map *threads);
31void perf_evlist__exit(struct perf_evlist *evlist); 35void perf_evlist__exit(struct perf_evlist *evlist);
32void perf_evlist__delete(struct perf_evlist *evlist); 36void perf_evlist__delete(struct perf_evlist *evlist);
33 37
34void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry); 38void perf_evlist__add(struct perf_evlist *evlist, struct perf_evsel *entry);
35int perf_evlist__add_default(struct perf_evlist *evlist); 39int perf_evlist__add_default(struct perf_evlist *evlist);
36 40
37int perf_evlist__alloc_pollfd(struct perf_evlist *evlist, int ncpus, int nthreads); 41int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);
38void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd); 42void perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd);
39 43
40struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id); 44struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id);
41 45
42union perf_event *perf_evlist__read_on_cpu(struct perf_evlist *self, int cpu); 46union perf_event *perf_evlist__read_on_cpu(struct perf_evlist *self, int cpu);
43 47
44int perf_evlist__alloc_mmap(struct perf_evlist *evlist, int ncpus); 48int perf_evlist__alloc_mmap(struct perf_evlist *evlist);
45int perf_evlist__mmap(struct perf_evlist *evlist, struct cpu_map *cpus, 49int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite);
46 struct thread_map *threads, int pages, bool overwrite); 50void perf_evlist__munmap(struct perf_evlist *evlist);
47void perf_evlist__munmap(struct perf_evlist *evlist, int ncpus); 51
52static inline void perf_evlist__set_maps(struct perf_evlist *evlist,
53 struct cpu_map *cpus,
54 struct thread_map *threads)
55{
56 evlist->cpus = cpus;
57 evlist->threads = threads;
58}
59
60int perf_evlist__create_maps(struct perf_evlist *evlist, pid_t target_pid,
61 pid_t target_tid, const char *cpu_list);
62void perf_evlist__delete_maps(struct perf_evlist *evlist);
48 63
49#endif /* __PERF_EVLIST_H */ 64#endif /* __PERF_EVLIST_H */