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
@@ -141,8 +141,8 @@ struct dso {
|
||||
struct list_head node;
|
||||
struct rb_node rb_node; /* rbtree node sorted by long name */
|
||||
struct rb_root *root; /* root of rbtree that rb_node is in */
|
||||
struct rb_root symbols;
|
||||
struct rb_root symbol_names;
|
||||
struct rb_root_cached symbols;
|
||||
struct rb_root_cached symbol_names;
|
||||
struct rb_root_cached inlined_nodes;
|
||||
struct rb_root_cached srclines;
|
||||
struct {
|
||||
@@ -236,7 +236,7 @@ bool dso__loaded(const struct dso *dso);
|
||||
|
||||
static inline bool dso__has_symbols(const struct dso *dso)
|
||||
{
|
||||
return !RB_EMPTY_ROOT(&dso->symbols);
|
||||
return !RB_EMPTY_ROOT(&dso->symbols.rb_root);
|
||||
}
|
||||
|
||||
bool dso__sorted_by_name(const struct dso *dso);
|
||||
|
Reference in New Issue
Block a user