diff options
author | Davidlohr Bueso <dave@stgolabs.net> | 2018-12-06 11:18:18 -0800 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-01-25 15:12:10 +0100 |
commit | 2eb3d6894ae3b9cc8a94c91458a041c45773f23d (patch) | |
tree | 146c0a9ee9b5177a0142319aa606dc1dd18de79b /tools/perf/builtin-top.c | |
parent | 7137ff50b68a48bc28270c91b1c313259ab0c1c4 (diff) | |
download | linux-stable-2eb3d6894ae3b9cc8a94c91458a041c45773f23d.tar.gz linux-stable-2eb3d6894ae3b9cc8a94c91458a041c45773f23d.tar.bz2 linux-stable-2eb3d6894ae3b9cc8a94c91458a041c45773f23d.zip |
perf hist: 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), which is
something heavily required for histograms. Specifically, the following
are converted to rb_root_cached, and users accordingly:
hist::entries_in_array
hist::entries_in
hist::entries
hist::entries_collapsed
hist_entry::hroot_in
hist_entry::hroot_out
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-7-dave@stgolabs.net
[ Added some missing conversions to rb_first_cached() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-top.c')
-rw-r--r-- | tools/perf/builtin-top.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 5a486d4de56e..57b1d7495d02 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -367,7 +367,7 @@ static void perf_top__prompt_symbol(struct perf_top *top, const char *msg) if (p) *p = 0; - next = rb_first(&hists->entries); + next = rb_first_cached(&hists->entries); while (next) { n = rb_entry(next, struct hist_entry, rb_node); if (n->ms.sym && !strcmp(buf, n->ms.sym->name)) { |