Skip to content

Commit

Permalink
perf kmem: Resolve kernel symbols again
Browse files Browse the repository at this point in the history
Due to the assumption in perf_session__new that the kernel maps would be
created using the fake PERF_RECORD_MMAP event in a perf.data file 'perf
kmem --stat caller', that doesn't have such event, ends up not being
able to resolve the kernel addresses.

Fix it by calling perf_session__create_kernel_maps() in __cmd_kmem().

LKML-Reference: <new-submission>
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>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Arnaldo Carvalho de Melo committed Apr 2, 2010
1 parent a4e3b95 commit e727ca7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions tools/perf/builtin-kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@ static int __cmd_kmem(void)
if (session == NULL)
return -ENOMEM;

if (perf_session__create_kernel_maps(session) < 0)
goto out_delete;

if (!perf_session__has_traces(session, "kmem record"))
goto out_delete;

Expand Down
5 changes: 0 additions & 5 deletions tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ static int perf_session__open(struct perf_session *self, bool force)
return -1;
}

static inline int perf_session__create_kernel_maps(struct perf_session *self)
{
return map_groups__create_kernel_maps(&self->kmaps, self->vmlinux_maps);
}

struct perf_session *perf_session__new(const char *filename, int mode, bool force)
{
size_t len = filename ? strlen(filename) + 1 : 0;
Expand Down
5 changes: 5 additions & 0 deletions tools/perf/util/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ static inline int __perf_session__create_kernel_maps(struct perf_session *self,
self->vmlinux_maps, kernel);
}

static inline int perf_session__create_kernel_maps(struct perf_session *self)
{
return map_groups__create_kernel_maps(&self->kmaps, self->vmlinux_maps);
}

static inline struct map *
perf_session__new_module_map(struct perf_session *self,
u64 start, const char *filename)
Expand Down

0 comments on commit e727ca7

Please sign in to comment.