diff options
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index b13f42625549..0f7a4da2924c 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -20,8 +20,9 @@ | |||
20 | 20 | ||
21 | #include "perf.h" | 21 | #include "perf.h" |
22 | 22 | ||
23 | #include "util/symbol.h" | ||
24 | #include "util/color.h" | 23 | #include "util/color.h" |
24 | #include "util/session.h" | ||
25 | #include "util/symbol.h" | ||
25 | #include "util/thread.h" | 26 | #include "util/thread.h" |
26 | #include "util/util.h" | 27 | #include "util/util.h" |
27 | #include <linux/rbtree.h> | 28 | #include <linux/rbtree.h> |
@@ -926,7 +927,8 @@ static int symbol_filter(struct map *map, struct symbol *sym) | |||
926 | return 0; | 927 | return 0; |
927 | } | 928 | } |
928 | 929 | ||
929 | static void event__process_sample(const event_t *self, int counter) | 930 | static void event__process_sample(const event_t *self, |
931 | struct perf_session *session, int counter) | ||
930 | { | 932 | { |
931 | u64 ip = self->ip.ip; | 933 | u64 ip = self->ip.ip; |
932 | struct sym_entry *syme; | 934 | struct sym_entry *syme; |
@@ -946,7 +948,7 @@ static void event__process_sample(const event_t *self, int counter) | |||
946 | return; | 948 | return; |
947 | } | 949 | } |
948 | 950 | ||
949 | if (event__preprocess_sample(self, &al, symbol_filter) < 0 || | 951 | if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 || |
950 | al.sym == NULL) | 952 | al.sym == NULL) |
951 | return; | 953 | return; |
952 | 954 | ||
@@ -1053,7 +1055,7 @@ static void perf_session__mmap_read_counter(struct perf_session *self, | |||
1053 | } | 1055 | } |
1054 | 1056 | ||
1055 | if (event->header.type == PERF_RECORD_SAMPLE) | 1057 | if (event->header.type == PERF_RECORD_SAMPLE) |
1056 | event__process_sample(event, md->counter); | 1058 | event__process_sample(event, self, md->counter); |
1057 | else | 1059 | else |
1058 | event__process(event, self); | 1060 | event__process(event, self); |
1059 | old += size; | 1061 | old += size; |
@@ -1157,10 +1159,13 @@ static int __cmd_top(void) | |||
1157 | int i, counter; | 1159 | int i, counter; |
1158 | int ret; | 1160 | int ret; |
1159 | /* | 1161 | /* |
1160 | * XXX perf_session__new should allow passing a O_MMAP, so that all this | 1162 | * FIXME: perf_session__new should allow passing a O_MMAP, so that all this |
1161 | * mmap reading, etc is encapsulated in it. | 1163 | * mmap reading, etc is encapsulated in it. Use O_WRONLY for now. |
1162 | */ | 1164 | */ |
1163 | struct perf_session *session = NULL; | 1165 | struct perf_session *session = perf_session__new(NULL, O_WRONLY, false); |
1166 | |||
1167 | if (session == NULL) | ||
1168 | return -ENOMEM; | ||
1164 | 1169 | ||
1165 | if (target_pid != -1) | 1170 | if (target_pid != -1) |
1166 | event__synthesize_thread(target_pid, event__process, session); | 1171 | event__synthesize_thread(target_pid, event__process, session); |