diff options
author | 2018-12-06 11:18:17 -0800 | |
---|---|---|
committer | 2019-01-25 15:12:10 +0100 | |
commit | 7137ff50b68a48bc28270c91b1c313259ab0c1c4 (patch) | |
tree | 9af6b7fc0ae471e61d9a9d177f1f12d33e790d2b /tools/perf/util/dso.c | |
parent | perf util: Use cached rbtree for rblists (diff) | |
download | linux-7137ff50b68a48bc28270c91b1c313259ab0c1c4.tar.gz linux-7137ff50b68a48bc28270c91b1c313259ab0c1c4.tar.bz2 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.c')
-rw-r--r-- | tools/perf/util/dso.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 9ec4b2e6d4ac..a8a54115b115 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -1197,7 +1197,7 @@ struct dso *dso__new(const char *name) strcpy(dso->name, name); dso__set_long_name(dso, dso->name, false); dso__set_short_name(dso, dso->name, false); - dso->symbols = dso->symbol_names = RB_ROOT; + dso->symbols = dso->symbol_names = RB_ROOT_CACHED; dso->data.cache = RB_ROOT; dso->inlined_nodes = RB_ROOT_CACHED; dso->srclines = RB_ROOT_CACHED; @@ -1469,7 +1469,7 @@ size_t dso__fprintf(struct dso *dso, FILE *fp) ret += fprintf(fp, "%sloaded, ", dso__loaded(dso) ? "" : "NOT "); ret += dso__fprintf_buildid(dso, fp); ret += fprintf(fp, ")\n"); - for (nd = rb_first(&dso->symbols); nd; nd = rb_next(nd)) { + for (nd = rb_first_cached(&dso->symbols); nd; nd = rb_next(nd)) { struct symbol *pos = rb_entry(nd, struct symbol, rb_node); ret += symbol__fprintf(pos, fp); } |