diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-07-25 10:06:19 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-07-25 10:06:19 -0400 |
commit | 4152ab377b55e9d3e5700de00ef799519ead698d (patch) | |
tree | f0b01d51b9efe519ecbc9827bf1116de2a2317c3 /tools/perf/util | |
parent | 4f9bae351d299149a84f76cd34bf0150614e8c8e (diff) |
perf evlist: Introduce 'disable' method
To remove the last case of access to the FD() macro outside the library.
Inspired by a patch by Borislav that moved the FD() macro to util.h, for
namespace concerns I rather preferred to constrain it to ev{sel,list}.c.
Cc: Borislav Petkov <bp@amd64.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-qn893qsstcg366tkucu649qj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/evlist.c | 13 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index b021ea9265c3..e03e7bc8205e 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -91,6 +91,19 @@ int perf_evlist__add_default(struct perf_evlist *evlist) | |||
91 | return 0; | 91 | return 0; |
92 | } | 92 | } |
93 | 93 | ||
94 | void perf_evlist__disable(struct perf_evlist *evlist) | ||
95 | { | ||
96 | int cpu, thread; | ||
97 | struct perf_evsel *pos; | ||
98 | |||
99 | for (cpu = 0; cpu < evlist->cpus->nr; cpu++) { | ||
100 | list_for_each_entry(pos, &evlist->entries, node) { | ||
101 | for (thread = 0; thread < evlist->threads->nr; thread++) | ||
102 | ioctl(FD(pos, cpu, thread), PERF_EVENT_IOC_DISABLE); | ||
103 | } | ||
104 | } | ||
105 | } | ||
106 | |||
94 | int perf_evlist__alloc_pollfd(struct perf_evlist *evlist) | 107 | int perf_evlist__alloc_pollfd(struct perf_evlist *evlist) |
95 | { | 108 | { |
96 | int nfds = evlist->cpus->nr * evlist->threads->nr * evlist->nr_entries; | 109 | int nfds = evlist->cpus->nr * evlist->threads->nr * evlist->nr_entries; |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index b2b862374f37..ce85ae9ae57a 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -53,6 +53,8 @@ int perf_evlist__alloc_mmap(struct perf_evlist *evlist); | |||
53 | int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite); | 53 | int perf_evlist__mmap(struct perf_evlist *evlist, int pages, bool overwrite); |
54 | void perf_evlist__munmap(struct perf_evlist *evlist); | 54 | void perf_evlist__munmap(struct perf_evlist *evlist); |
55 | 55 | ||
56 | void perf_evlist__disable(struct perf_evlist *evlist); | ||
57 | |||
56 | static inline void perf_evlist__set_maps(struct perf_evlist *evlist, | 58 | static inline void perf_evlist__set_maps(struct perf_evlist *evlist, |
57 | struct cpu_map *cpus, | 59 | struct cpu_map *cpus, |
58 | struct thread_map *threads) | 60 | struct thread_map *threads) |