diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2018-12-06 20:18:17 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-01-25 15:12:10 +0100 |
commit | 7137ff50b68a48bc28270c91b1c313259ab0c1c4 (patch) | |
tree | 9af6b7fc0ae471e61d9a9d177f1f12d33e790d2b /tools/perf/util/dso.h | |
parent | perf util: Use cached rbtree for rblists (diff) | |
download | linux-7137ff50b68a48bc28270c91b1c313259ab0c1c4.tar.xz linux-7137ff50b68a48bc28270c91b1c313259ab0c1c4.zip |
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>
Diffstat (limited to 'tools/perf/util/dso.h')
-rw-r--r-- | tools/perf/util/dso.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index 40edfb375a8b..bb417c54c25a 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -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); |