diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-01-27 18:05:52 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-29 03:20:58 -0500 |
commit | 64abebf731df87e6f4ae7d9ffc340bdf0c033e44 (patch) | |
tree | 5ccf8953ac39f72875254321dd51e9ec9503aaa0 /tools | |
parent | fd1d908c543fbdfae82839d24b0872c542fceedc (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')
-rw-r--r-- | tools/perf/builtin-kmem.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 5 | ||||
-rw-r--r-- | tools/perf/util/session.c | 13 |
4 files changed, 11 insertions, 17 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 7323d9dfbce8..38b8ca900eda 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -491,11 +491,6 @@ static int __cmd_kmem(void) | |||
491 | if (!perf_session__has_traces(session, "kmem record")) | 491 | if (!perf_session__has_traces(session, "kmem record")) |
492 | goto out_delete; | 492 | goto out_delete; |
493 | 493 | ||
494 | if (perf_session__create_kernel_maps(session) < 0) { | ||
495 | pr_err("Problems creating kernel maps\n"); | ||
496 | return -1; | ||
497 | } | ||
498 | |||
499 | setup_pager(); | 494 | setup_pager(); |
500 | err = perf_session__process_events(session, &event_ops); | 495 | err = perf_session__process_events(session, &event_ops); |
501 | if (err != 0) | 496 | if (err != 0) |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 7bb9ca1b30fa..90345223908c 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -477,11 +477,6 @@ static int __cmd_record(int argc, const char **argv) | |||
477 | return -1; | 477 | return -1; |
478 | } | 478 | } |
479 | 479 | ||
480 | if (perf_session__create_kernel_maps(session) < 0) { | ||
481 | pr_err("Problems creating kernel maps\n"); | ||
482 | return -1; | ||
483 | } | ||
484 | |||
485 | if (!file_new) { | 480 | if (!file_new) { |
486 | err = perf_header__read(&session->header, output); | 481 | err = perf_header__read(&session->header, output); |
487 | if (err < 0) | 482 | if (err < 0) |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 78f9c4576a0c..1fc018e048e1 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -1191,11 +1191,6 @@ static int __cmd_top(void) | |||
1191 | if (session == NULL) | 1191 | if (session == NULL) |
1192 | return -ENOMEM; | 1192 | return -ENOMEM; |
1193 | 1193 | ||
1194 | if (perf_session__create_kernel_maps(session) < 0) { | ||
1195 | pr_err("Problems creating kernel maps\n"); | ||
1196 | return -1; | ||
1197 | } | ||
1198 | |||
1199 | if (target_pid != -1) | 1194 | if (target_pid != -1) |
1200 | event__synthesize_thread(target_pid, event__process, session); | 1195 | event__synthesize_thread(target_pid, event__process, session); |
1201 | else | 1196 | else |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 1951e330377c..8e7c1896eaa2 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 | |||
70 | self->unknown_events = 0; | 70 | self->unknown_events = 0; |
71 | map_groups__init(&self->kmaps); | 71 | map_groups__init(&self->kmaps); |
72 | 72 | ||
73 | if (mode == O_RDONLY && perf_session__open(self, force) < 0) | 73 | if (mode == O_RDONLY) { |
74 | goto out_delete; | 74 | if (perf_session__open(self, force) < 0) |
75 | goto out_delete; | ||
76 | } else if (mode == O_WRONLY) { | ||
77 | /* | ||
78 | * In O_RDONLY mode this will be performed when reading the | ||
79 | * kernel MMAP event, in event__process_mmap(). | ||
80 | */ | ||
81 | if (perf_session__create_kernel_maps(self) < 0) | ||
82 | goto out_delete; | ||
83 | } | ||
75 | 84 | ||
76 | self->sample_type = perf_header__sample_type(&self->header); | 85 | self->sample_type = perf_header__sample_type(&self->header); |
77 | out: | 86 | out: |