All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: David Miller <davem@davemloft.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] perf symbols: Fill in pgoff in mmap synthesized events
Date: Sat, 3 Apr 2010 22:53:31 +1100	[thread overview]
Message-ID: <20100403115331.GK5594@kryten> (raw)


When we synthesize mmap events we need to fill in the pgoff field. 

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

I wasn't able to test this completely since I couldn't find an executable
region with a non 0 offset. We will see it when we start doing data
profiling.

Index: linux.trees.git/tools/perf/util/event.c
===================================================================
--- linux.trees.git.orig/tools/perf/util/event.c	2010-04-01 07:55:13.000000000 +1100
+++ linux.trees.git/tools/perf/util/event.c	2010-04-03 22:45:02.000000000 +1100
@@ -130,6 +130,7 @@ static int event__synthesize_mmap_events
 			continue;
 		pbf += n + 3;
 		if (*pbf == 'x') { /* vm_exec */
+			u64 vm_pgoff;
 			char *execname = strchr(bf, '/');
 
 			/* Catch VDSO */
@@ -139,6 +140,14 @@ static int event__synthesize_mmap_events
 			if (execname == NULL)
 				continue;
 
+			pbf += 3;
+			n = hex2u64(pbf, &vm_pgoff);
+			/* pgoff is in bytes, not pages */
+			if (n >= 0)
+				ev.mmap.pgoff = vm_pgoff << getpagesize();
+			else
+				ev.mmap.pgoff = 0;
+
 			size = strlen(execname);
 			execname[size - 1] = '\0'; /* Remove \n */
 			memcpy(ev.mmap.filename, execname, size);

             reply	other threads:[~2010-04-03 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-03 11:53 Anton Blanchard [this message]
2010-04-03 13:40 ` [PATCH] perf symbols: Fill in pgoff in mmap synthesized events Arnaldo Carvalho de Melo
2010-04-03 16:25 ` [tip:perf/core] " tip-bot for Anton Blanchard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100403115331.GK5594@kryten \
    --to=anton@samba.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.