From 4af8b35db6634dd1e0d616de689582b6c93550af Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Sat, 3 Apr 2010 22:53:31 +1100 Subject: [PATCH] perf symbols: Fill in pgoff in mmap synthesized events When we synthesize mmap events we need to fill in the pgoff field. 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. Signed-off-by: Anton Blanchard Cc: David Miller Cc: Peter Zijlstra Cc: Paul Mackerras LKML-Reference: <20100403115331.GK5594@kryten> Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/event.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 052eaeccc202..571fb25f7eb9 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -130,6 +130,7 @@ static int event__synthesize_mmap_events(pid_t pid, pid_t tgid, 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(pid_t pid, pid_t tgid, 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);