summaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-01-27 21:05:52 -0200
committerIngo Molnar <mingo@elte.hu>2010-01-29 09:20:58 +0100
commit64abebf731df87e6f4ae7d9ffc340bdf0c033e44 (patch)
tree5ccf8953ac39f72875254321dd51e9ec9503aaa0 /tools/perf/util
parentfd1d908c543fbdfae82839d24b0872c542fceedc (diff)
perf session: Create kernel maps in the constructor
Removing one extra step needed in the tools that need this, fixing a bug in 'perf probe' where this was not being done. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Masami Hiramatsu <mhiramat@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: <1264633557-17597-4-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/session.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 1951e330377..8e7c1896eaa 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -70,8 +70,17 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
self->unknown_events = 0;
map_groups__init(&self->kmaps);
- if (mode == O_RDONLY && perf_session__open(self, force) < 0)
- goto out_delete;
+ if (mode == O_RDONLY) {
+ if (perf_session__open(self, force) < 0)
+ goto out_delete;
+ } else if (mode == O_WRONLY) {
+ /*
+ * In O_RDONLY mode this will be performed when reading the
+ * kernel MMAP event, in event__process_mmap().
+ */
+ if (perf_session__create_kernel_maps(self) < 0)
+ goto out_delete;
+ }
self->sample_type = perf_header__sample_type(&self->header);
out: