Commit cd67f99f authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf symbols: Add dso__last_symbol()

Add a function to find the last symbol in a DSO. This will be used when
parsing address filters to calculate a region that includes the entire
DSO.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: http://lkml.kernel.org/r/1474641528-18776-7-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5c01ad60
...@@ -345,6 +345,16 @@ static struct symbol *symbols__first(struct rb_root *symbols) ...@@ -345,6 +345,16 @@ static struct symbol *symbols__first(struct rb_root *symbols)
return NULL; return NULL;
} }
static struct symbol *symbols__last(struct rb_root *symbols)
{
struct rb_node *n = rb_last(symbols);
if (n)
return rb_entry(n, struct symbol, rb_node);
return NULL;
}
static struct symbol *symbols__next(struct symbol *sym) static struct symbol *symbols__next(struct symbol *sym)
{ {
struct rb_node *n = rb_next(&sym->rb_node); struct rb_node *n = rb_next(&sym->rb_node);
...@@ -466,6 +476,11 @@ struct symbol *dso__first_symbol(struct dso *dso, enum map_type type) ...@@ -466,6 +476,11 @@ struct symbol *dso__first_symbol(struct dso *dso, enum map_type type)
return symbols__first(&dso->symbols[type]); return symbols__first(&dso->symbols[type]);
} }
struct symbol *dso__last_symbol(struct dso *dso, enum map_type type)
{
return symbols__last(&dso->symbols[type]);
}
struct symbol *dso__next_symbol(struct symbol *sym) struct symbol *dso__next_symbol(struct symbol *sym)
{ {
return symbols__next(sym); return symbols__next(sym);
......
...@@ -259,6 +259,7 @@ struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type, ...@@ -259,6 +259,7 @@ struct symbol *dso__find_symbol_by_name(struct dso *dso, enum map_type type,
struct symbol *symbol__next_by_name(struct symbol *sym); struct symbol *symbol__next_by_name(struct symbol *sym);
struct symbol *dso__first_symbol(struct dso *dso, enum map_type type); struct symbol *dso__first_symbol(struct dso *dso, enum map_type type);
struct symbol *dso__last_symbol(struct dso *dso, enum map_type type);
struct symbol *dso__next_symbol(struct symbol *sym); struct symbol *dso__next_symbol(struct symbol *sym);
enum dso_type dso__type_fd(int fd); enum dso_type dso__type_fd(int fd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment