Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a4694a4 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar
Browse files

perf symbols: Better support for multiple symbol tables per dso



By using an array of rb_roots in struct dso we can, from a
struct map instance to get the right symbol rb_tree more easily.
This way we can have just one symbol lookup method for struct
map instances, map__find_symbol, instead of one per symtab type
(functions, variables).

Signed-off-by: default avatarArnaldo 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: <1259346563-12568-6-git-send-email-acme@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 3610583c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ process_sample_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);
			sym = map__find_function(map, ip, symbol_filter);
			sym = map__find_symbol(map, ip, symbol_filter);
		} else {
			/*
			 * If this is outside of all known maps,
+1 −1
Original line number Diff line number Diff line
@@ -455,7 +455,7 @@ got_map:
	dump_printf(" ...... map: %Lx -> %Lx\n", *ipp, ip);
	*ipp  = ip;

	return map ? map__find_function(map, ip, NULL) : NULL;
	return map ? map__find_symbol(map, ip, NULL) : NULL;
}

static int call__match(struct symbol *sym)
+1 −1
Original line number Diff line number Diff line
@@ -948,7 +948,7 @@ static void event__process_sample(const event_t *self, int counter)
		map = thread__find_map(thread, ip);
		if (map != NULL) {
			ip = map->map_ip(map, ip);
			sym = map__find_function(map, ip, symbol_filter);
			sym = map__find_symbol(map, ip, symbol_filter);
			if (sym == NULL)
				return;
			userspace_samples++;
+7 −5
Original line number Diff line number Diff line
@@ -81,7 +81,9 @@ typedef union event_union {
} event_t;

enum map_type {
	MAP__FUNCTION,
	MAP__FUNCTION = 0,

	MAP__NR_TYPES,
};

struct map {
@@ -125,10 +127,10 @@ void map__delete(struct map *self);
struct map *map__clone(struct map *self);
int map__overlap(struct map *l, struct map *r);
size_t map__fprintf(struct map *self, FILE *fp);
struct symbol *map__find_function(struct map *self, u64 ip,
struct symbol *map__find_symbol(struct map *self, u64 addr,
				symbol_filter_t filter);
void map__fixup_start(struct map *self, struct rb_root *symbols);
void map__fixup_end(struct map *self, struct rb_root *symbols);
void map__fixup_start(struct map *self);
void map__fixup_end(struct map *self);

int event__synthesize_thread(pid_t pid, int (*process)(event_t *event));
void event__synthesize_threads(int (*process)(event_t *event));
+7 −5
Original line number Diff line number Diff line
@@ -82,8 +82,9 @@ void map__delete(struct map *self)
	free(self);
}

void map__fixup_start(struct map *self, struct rb_root *symbols)
void map__fixup_start(struct map *self)
{
	struct rb_root *symbols = &self->dso->symbols[self->type];
	struct rb_node *nd = rb_first(symbols);
	if (nd != NULL) {
		struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
@@ -91,8 +92,9 @@ void map__fixup_start(struct map *self, struct rb_root *symbols)
	}
}

void map__fixup_end(struct map *self, struct rb_root *symbols)
void map__fixup_end(struct map *self)
{
	struct rb_root *symbols = &self->dso->symbols[self->type];
	struct rb_node *nd = rb_last(symbols);
	if (nd != NULL) {
		struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
@@ -102,7 +104,7 @@ void map__fixup_end(struct map *self, struct rb_root *symbols)

#define DSO__DELETED "(deleted)"

struct symbol *map__find_function(struct map *self, u64 ip,
struct symbol *map__find_symbol(struct map *self, u64 addr,
				symbol_filter_t filter)
{
	if (!dso__loaded(self->dso, self->type)) {
@@ -138,7 +140,7 @@ struct symbol *map__find_function(struct map *self, u64 ip,
		}
	}

	return self->dso->find_function(self->dso, ip);
	return self->dso->find_symbol(self->dso, self->type, addr);
}

struct map *map__clone(struct map *self)
Loading