diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 8 | ||||
-rw-r--r-- | tools/perf/util/event.c | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index c130df2676f1..614fa9a4c67c 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -117,8 +117,12 @@ static void write_event(event_t *buf, size_t size) | |||
117 | * Add it to the list of DSOs, so that when we finish this | 117 | * Add it to the list of DSOs, so that when we finish this |
118 | * record session we can pick the available build-ids. | 118 | * record session we can pick the available build-ids. |
119 | */ | 119 | */ |
120 | if (buf->header.type == PERF_RECORD_MMAP) | 120 | if (buf->header.type == PERF_RECORD_MMAP) { |
121 | dsos__findnew(buf->mmap.filename); | 121 | struct list_head *head = &dsos__user; |
122 | if (buf->mmap.header.misc == 1) | ||
123 | head = &dsos__kernel; | ||
124 | __dsos__findnew(head, buf->mmap.filename); | ||
125 | } | ||
122 | 126 | ||
123 | write_output(buf, size); | 127 | write_output(buf, size); |
124 | } | 128 | } |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 0e9820ac4f5e..1abaefc126a8 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -110,7 +110,10 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid, | |||
110 | while (1) { | 110 | while (1) { |
111 | char bf[BUFSIZ], *pbf = bf; | 111 | char bf[BUFSIZ], *pbf = bf; |
112 | event_t ev = { | 112 | event_t ev = { |
113 | .header = { .type = PERF_RECORD_MMAP }, | 113 | .header = { |
114 | .type = PERF_RECORD_MMAP, | ||
115 | .misc = 0, /* Just like the kernel, see kernel/perf_event.c __perf_event_mmap */ | ||
116 | }, | ||
114 | }; | 117 | }; |
115 | int n; | 118 | int n; |
116 | size_t size; | 119 | size_t size; |
@@ -170,6 +173,7 @@ int event__synthesize_modules(event__handler_t process, | |||
170 | 173 | ||
171 | size = ALIGN(pos->dso->long_name_len + 1, sizeof(u64)); | 174 | size = ALIGN(pos->dso->long_name_len + 1, sizeof(u64)); |
172 | memset(&ev, 0, sizeof(ev)); | 175 | memset(&ev, 0, sizeof(ev)); |
176 | ev.mmap.header.misc = 1; /* kernel uses 0 for user space maps, see kernel/perf_event.c __perf_event_mmap */ | ||
173 | ev.mmap.header.type = PERF_RECORD_MMAP; | 177 | ev.mmap.header.type = PERF_RECORD_MMAP; |
174 | ev.mmap.header.size = (sizeof(ev.mmap) - | 178 | ev.mmap.header.size = (sizeof(ev.mmap) - |
175 | (sizeof(ev.mmap.filename) - size)); | 179 | (sizeof(ev.mmap.filename) - size)); |
@@ -236,7 +240,10 @@ int event__synthesize_kernel_mmap(event__handler_t process, | |||
236 | { | 240 | { |
237 | size_t size; | 241 | size_t size; |
238 | event_t ev = { | 242 | event_t ev = { |
239 | .header = { .type = PERF_RECORD_MMAP }, | 243 | .header = { |
244 | .type = PERF_RECORD_MMAP, | ||
245 | .misc = 1, /* kernel uses 0 for user space maps, see kernel/perf_event.c __perf_event_mmap */ | ||
246 | }, | ||
240 | }; | 247 | }; |
241 | /* | 248 | /* |
242 | * We should get this from /sys/kernel/sections/.text, but till that is | 249 | * We should get this from /sys/kernel/sections/.text, but till that is |