[PATCH 2/2] perf tools: Synthesize data mmap events for threads

From: Namhyung Kim
Date: Sun Nov 11 2012 - 09:21:12 EST


Current perf_event__synthesize_mmap_events() only deals with
executable mappings. With recently added memory access sampling,
non-executable data mappings are needed also.

Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/util/event.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 3cf2c3e0605f..06e4d57a9e29 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -210,11 +210,15 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool,
&event->mmap.start, &event->mmap.len, prot,
&event->mmap.pgoff, execname);

- if (prot[2] != 'x')
- continue;
+ if (prot[2] == 'x' && !strcmp(execname, ""))
+ strcpy(execname, anonstr);

+ /* ignore non-executable anon mappings */
if (!strcmp(execname, ""))
- strcpy(execname, anonstr);
+ continue;
+
+ if (prot[2] != 'x')
+ event->header.misc |= PERF_RECORD_MISC_MMAP_USER;

size = strlen(execname) + 1;
memcpy(event->mmap.filename, execname, size);
--
1.7.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/