perf symbols: Use cached rbtrees
At the cost of an extra pointer, we can avoid the O(logN) cost of finding the first element in the tree (smallest node). Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/20181206191819.30182-6-dave@stgolabs.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
ca2270292e
commit
7137ff50b6
@@ -286,8 +286,8 @@ void map__put(struct map *map)
|
||||
|
||||
void map__fixup_start(struct map *map)
|
||||
{
|
||||
struct rb_root *symbols = &map->dso->symbols;
|
||||
struct rb_node *nd = rb_first(symbols);
|
||||
struct rb_root_cached *symbols = &map->dso->symbols;
|
||||
struct rb_node *nd = rb_first_cached(symbols);
|
||||
if (nd != NULL) {
|
||||
struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
|
||||
map->start = sym->start;
|
||||
@@ -296,8 +296,8 @@ void map__fixup_start(struct map *map)
|
||||
|
||||
void map__fixup_end(struct map *map)
|
||||
{
|
||||
struct rb_root *symbols = &map->dso->symbols;
|
||||
struct rb_node *nd = rb_last(symbols);
|
||||
struct rb_root_cached *symbols = &map->dso->symbols;
|
||||
struct rb_node *nd = rb_last(&symbols->rb_root);
|
||||
if (nd != NULL) {
|
||||
struct symbol *sym = rb_entry(nd, struct symbol, rb_node);
|
||||
map->end = sym->end;
|
||||
|
Reference in New Issue
Block a user