aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-01-14 20:45:28 -0500
committerIngo Molnar <mingo@elte.hu>2010-01-16 04:58:48 -0500
commit18c3daa4961b9fa1f2db0711d93c0acf0c39fd12 (patch)
tree03169979a334fa753e740d4638d62f9747ba3f72 /tools/perf/util
parentcf4e5b0838e822dd404638ad00d35b63fffe8191 (diff)
perf record: Encode the domain while synthesizing MMAP events
In the past 'perf record' had to process only userspace MMAP events, the ones generated in the kernel, but after we reused the MMAP events to encode the module mapings we ended up adding them first to the list of userspace DSOs (dsos__user) and to the kernel one (dsos__kernel). Fix this by encoding the header.misc field and then using it, like other parts to decide the right DSOs list to insert/find. The gotcha here is that since the kernel puts zero in .misc, which isn't PERF_RECORD_MISC_KERNEL (1 << 1), to differentiate, we put 1 in .misc. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1263519930-22803-2-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/event.c11
1 files changed, 9 insertions, 2 deletions
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