public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf symbols: Synthesize anonymous mmap events
@ 2011-08-29 23:15 Anton Blanchard
  2011-08-30 19:11 ` Pekka Enberg
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2011-08-29 23:15 UTC (permalink / raw)
  To: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, emunson, penberg
  Cc: linux-kernel


perf_event__synthesize_mmap_events does not create anonymous mmap
events even though the kernel does. As a result an already running
application with dynamically created code will not get profiled -
all samples end up in the unknown bucket.

This patch skips any entries with '[' in the name to avoid adding
events for special regions (eg the vsyscall page). All other
executable mmaps are assumed to be anonymous and an event is
synthesized.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 3c1b8a6..437f8ca 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -169,12 +169,17 @@ static int perf_event__synthesize_mmap_events(union perf_event *event,
 			continue;
 		pbf += n + 3;
 		if (*pbf == 'x') { /* vm_exec */
+			char anonstr[] = "//anon\n";
 			char *execname = strchr(bf, '/');
 
 			/* Catch VDSO */
 			if (execname == NULL)
 				execname = strstr(bf, "[vdso]");
 
+			/* Catch anonymous mmaps */
+			if ((execname == NULL) && !strstr(bf, "["))
+				execname = anonstr;
+
 			if (execname == NULL)
 				continue;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf symbols: Synthesize anonymous mmap events
  2011-08-29 23:15 [PATCH] perf symbols: Synthesize anonymous mmap events Anton Blanchard
@ 2011-08-30 19:11 ` Pekka Enberg
  0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2011-08-30 19:11 UTC (permalink / raw)
  To: Anton Blanchard
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, emunson, linux-kernel

On Tue, 2011-08-30 at 09:15 +1000, Anton Blanchard wrote:
> perf_event__synthesize_mmap_events does not create anonymous mmap
> events even though the kernel does. As a result an already running
> application with dynamically created code will not get profiled -
> all samples end up in the unknown bucket.
> 
> This patch skips any entries with '[' in the name to avoid adding
> events for special regions (eg the vsyscall page). All other
> executable mmaps are assumed to be anonymous and an event is
> synthesized.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

Acked-by: Pekka Enberg <penberg@kernel.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-30 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-29 23:15 [PATCH] perf symbols: Synthesize anonymous mmap events Anton Blanchard
2011-08-30 19:11 ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox