Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147669
b: refs/heads/master
c: fc54db5
h: refs/heads/master
i:
  147667: 0355e40
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 5, 2009
1 parent 2392129 commit 5cfcf86
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 089dd79db9264dc0da602bad45d42f1b3e7d1e07
refs/heads/master: fc54db5105d01ad691a7d747064c7890e17f936c
37 changes: 35 additions & 2 deletions trunk/Documentation/perf_counter/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ typedef union event_union {

static LIST_HEAD(dsos);
static struct dso *kernel_dso;
static struct dso *vdso;

static void dsos__add(struct dso *dso)
{
Expand Down Expand Up @@ -136,6 +137,11 @@ static void dsos__fprintf(FILE *fp)
dso__fprintf(pos, fp);
}

static struct symbol *vdso__find_symbol(struct dso *dso, uint64_t ip)
{
return dso__find_symbol(kernel_dso, ip);
}

static int load_kernel(void)
{
int err;
Expand All @@ -151,6 +157,14 @@ static int load_kernel(void)
} else
dsos__add(kernel_dso);

vdso = dso__new("[vdso]", 0);
if (!vdso)
return -1;

vdso->find_symbol = vdso__find_symbol;

dsos__add(vdso);

return err;
}

Expand All @@ -173,9 +187,20 @@ struct map {
uint64_t start;
uint64_t end;
uint64_t pgoff;
uint64_t (*map_ip)(struct map *, uint64_t);
struct dso *dso;
};

static uint64_t map__map_ip(struct map *map, uint64_t ip)
{
return ip - map->start + map->pgoff;
}

static uint64_t vdso__map_ip(struct map *map, uint64_t ip)
{
return ip;
}

static struct map *map__new(struct mmap_event *event)
{
struct map *self = malloc(sizeof(*self));
Expand All @@ -201,6 +226,11 @@ static struct map *map__new(struct mmap_event *event)
self->dso = dsos__findnew(filename);
if (self->dso == NULL)
goto out_delete;

if (self->dso == vdso)
self->map_ip = vdso__map_ip;
else
self->map_ip = map__map_ip;
}
return self;
out_delete:
Expand Down Expand Up @@ -917,8 +947,8 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)

map = thread__find_map(thread, ip);
if (map != NULL) {
ip = map->map_ip(map, ip);
dso = map->dso;
ip -= map->start + map->pgoff;
} else {
/*
* If this is outside of all known maps,
Expand All @@ -938,7 +968,10 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
}

if (show & show_mask) {
struct symbol *sym = dso__find_symbol(dso, ip);
struct symbol *sym = NULL;

if (dso)
sym = dso->find_symbol(dso, ip);

if (hist_entry__add(thread, map, dso, sym, ip, level)) {
fprintf(stderr,
Expand Down
1 change: 1 addition & 0 deletions trunk/Documentation/perf_counter/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct dso *dso__new(const char *name, unsigned int sym_priv_size)
strcpy(self->name, name);
self->syms = RB_ROOT;
self->sym_priv_size = sym_priv_size;
self->find_symbol = dso__find_symbol;
}

return self;
Expand Down
1 change: 1 addition & 0 deletions trunk/Documentation/perf_counter/util/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct dso {
struct list_head node;
struct rb_root syms;
unsigned int sym_priv_size;
struct symbol *(*find_symbol)(struct dso *, uint64_t ip);
char name[0];
};

Expand Down

0 comments on commit 5cfcf86

Please sign in to comment.