Skip to content

Commit b177f63

Browse files
acmelIngo Molnar
authored andcommitted
perf symbols: Pass the mmap parameters instead of using mmap_event
To reduce the coupling of the symbol system with the rest of perf. Signed-off-by: Arnaldo Carvalho de Melo <acme@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: <1269557941-15617-2-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent d5679ae commit b177f63

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎tools/perf/util/event.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ int event__process_mmap(event_t *self, struct perf_session *session)
393393
}
394394

395395
thread = perf_session__findnew(session, self->mmap.pid);
396-
map = map__new(&self->mmap, MAP__FUNCTION,
396+
map = map__new(self->mmap.start, self->mmap.len, self->mmap.pgoff,
397+
self->mmap.pid, self->mmap.filename, MAP__FUNCTION,
397398
session->cwd, session->cwdlen);
398399

399400
if (thread == NULL || map == NULL)

‎tools/perf/util/map.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "event.h"
21
#include "symbol.h"
32
#include <stdlib.h>
43
#include <string.h>
@@ -38,13 +37,12 @@ void map__init(struct map *self, enum map_type type,
3837
RB_CLEAR_NODE(&self->rb_node);
3938
}
4039

41-
struct map *map__new(struct mmap_event *event, enum map_type type,
42-
char *cwd, int cwdlen)
40+
struct map *map__new(u64 start, u64 len, u64 pgoff, u32 pid, char *filename,
41+
enum map_type type, char *cwd, int cwdlen)
4342
{
4443
struct map *self = malloc(sizeof(*self));
4544

4645
if (self != NULL) {
47-
const char *filename = event->filename;
4846
char newfilename[PATH_MAX];
4947
struct dso *dso;
5048
int anon;
@@ -62,16 +60,15 @@ struct map *map__new(struct mmap_event *event, enum map_type type,
6260
anon = is_anon_memory(filename);
6361

6462
if (anon) {
65-
snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", event->pid);
63+
snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid);
6664
filename = newfilename;
6765
}
6866

6967
dso = dsos__findnew(filename);
7068
if (dso == NULL)
7169
goto out_delete;
7270

73-
map__init(self, type, event->start, event->start + event->len,
74-
event->pgoff, dso);
71+
map__init(self, type, start, start + len, pgoff, dso);
7572

7673
if (anon) {
7774
set_identity:

‎tools/perf/util/map.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,13 @@ u64 map__rip_2objdump(struct map *map, u64 rip);
6868
u64 map__objdump_2ip(struct map *map, u64 addr);
6969

7070
struct symbol;
71-
struct mmap_event;
7271

7372
typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
7473

7574
void map__init(struct map *self, enum map_type type,
7675
u64 start, u64 end, u64 pgoff, struct dso *dso);
77-
struct map *map__new(struct mmap_event *event, enum map_type,
78-
char *cwd, int cwdlen);
76+
struct map *map__new(u64 start, u64 len, u64 pgoff, u32 pid, char *filename,
77+
enum map_type type, char *cwd, int cwdlen);
7978
void map__delete(struct map *self);
8079
struct map *map__clone(struct map *self);
8180
int map__overlap(struct map *l, struct map *r);

0 commit comments

Comments
 (0)