Commit 64abebf7 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar

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: default avatarArnaldo 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: default avatarIngo Molnar <mingo@elte.hu>
parent fd1d908c
...@@ -491,11 +491,6 @@ static int __cmd_kmem(void) ...@@ -491,11 +491,6 @@ static int __cmd_kmem(void)
if (!perf_session__has_traces(session, "kmem record")) if (!perf_session__has_traces(session, "kmem record"))
goto out_delete; goto out_delete;
if (perf_session__create_kernel_maps(session) < 0) {
pr_err("Problems creating kernel maps\n");
return -1;
}
setup_pager(); setup_pager();
err = perf_session__process_events(session, &event_ops); err = perf_session__process_events(session, &event_ops);
if (err != 0) if (err != 0)
......
...@@ -477,11 +477,6 @@ static int __cmd_record(int argc, const char **argv) ...@@ -477,11 +477,6 @@ static int __cmd_record(int argc, const char **argv)
return -1; return -1;
} }
if (perf_session__create_kernel_maps(session) < 0) {
pr_err("Problems creating kernel maps\n");
return -1;
}
if (!file_new) { if (!file_new) {
err = perf_header__read(&session->header, output); err = perf_header__read(&session->header, output);
if (err < 0) if (err < 0)
......
...@@ -1191,11 +1191,6 @@ static int __cmd_top(void) ...@@ -1191,11 +1191,6 @@ static int __cmd_top(void)
if (session == NULL) if (session == NULL)
return -ENOMEM; return -ENOMEM;
if (perf_session__create_kernel_maps(session) < 0) {
pr_err("Problems creating kernel maps\n");
return -1;
}
if (target_pid != -1) if (target_pid != -1)
event__synthesize_thread(target_pid, event__process, session); event__synthesize_thread(target_pid, event__process, session);
else else
......
...@@ -70,8 +70,17 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc ...@@ -70,8 +70,17 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
self->unknown_events = 0; self->unknown_events = 0;
map_groups__init(&self->kmaps); map_groups__init(&self->kmaps);
if (mode == O_RDONLY && perf_session__open(self, force) < 0) if (mode == O_RDONLY) {
goto out_delete; 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); self->sample_type = perf_header__sample_type(&self->header);
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment