diff options
| -rw-r--r-- | tools/perf/builtin-record.c | 19 | ||||
| -rw-r--r-- | tools/perf/util/evlist.c | 13 | ||||
| -rw-r--r-- | tools/perf/util/evlist.h | 2 |
3 files changed, 17 insertions, 17 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 80dc5b790e47..f6426b496f4a 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
| @@ -30,8 +30,6 @@ | |||
| 30 | #include <sched.h> | 30 | #include <sched.h> |
| 31 | #include <sys/mman.h> | 31 | #include <sys/mman.h> |
| 32 | 32 | ||
| 33 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) | ||
| 34 | |||
| 35 | enum write_mode_t { | 33 | enum write_mode_t { |
| 36 | WRITE_FORCE, | 34 | WRITE_FORCE, |
| 37 | WRITE_APPEND | 35 | WRITE_APPEND |
| @@ -438,7 +436,6 @@ static void mmap_read_all(void) | |||
| 438 | 436 | ||
| 439 | static int __cmd_record(int argc, const char **argv) | 437 | static int __cmd_record(int argc, const char **argv) |
| 440 | { | 438 | { |
| 441 | int i; | ||
| 442 | struct stat st; | 439 | struct stat st; |
| 443 | int flags; | 440 | int flags; |
| 444 | int err; | 441 | int err; |
| @@ -682,7 +679,6 @@ static int __cmd_record(int argc, const char **argv) | |||
| 682 | 679 | ||
| 683 | for (;;) { | 680 | for (;;) { |
| 684 | int hits = samples; | 681 | int hits = samples; |
| 685 | int thread; | ||
| 686 | 682 | ||
| 687 | mmap_read_all(); | 683 | mmap_read_all(); |
| 688 | 684 | ||
| @@ -693,19 +689,8 @@ static int __cmd_record(int argc, const char **argv) | |||
| 693 | waking++; | 689 | waking++; |
| 694 | } | 690 | } |
| 695 | 691 | ||
| 696 | if (done) { | 692 | if (done) |
| 697 | for (i = 0; i < evsel_list->cpus->nr; i++) { | 693 | perf_evlist__disable(evsel_list); |
| 698 | struct perf_evsel *pos; | ||
| 699 | |||
| 700 | list_for_each_entry(pos, &evsel_list->entries, node) { | ||
| 701 | for (thread = 0; | ||
| 702 | thread < evsel_list->threads->nr; | ||
| 703 | thread++) | ||
| 704 | ioctl(FD(pos, i, thread), | ||
| 705 | PERF_EVENT_IOC_DISABLE); | ||
| 706 | } | ||
| 707 | } | ||
| 708 | } | ||
| 709 | } | 694 | } |
| 710 | 695 | ||
| 711 | if (quiet || signr == SIGUSR1) | 696 | if (quiet || signr == SIGUSR1) |
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) |
