perf hist: Use cached rbtrees
authorDavidlohr Bueso <dave@stgolabs.net>
Thu, 6 Dec 2018 19:18:18 +0000 (11:18 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 25 Jan 2019 14:12:10 +0000 (15:12 +0100)
commit2eb3d6894ae3b9cc8a94c91458a041c45773f23d
tree146c0a9ee9b5177a0142319aa606dc1dd18de79b
parent7137ff50b68a48bc28270c91b1c313259ab0c1c4
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>
14 files changed:
tools/perf/builtin-annotate.c
tools/perf/builtin-c2c.c
tools/perf/builtin-diff.c
tools/perf/builtin-top.c
tools/perf/tests/hists_common.c
tools/perf/tests/hists_cumulate.c
tools/perf/tests/hists_link.c
tools/perf/tests/hists_output.c
tools/perf/ui/browsers/hists.c
tools/perf/ui/gtk/hists.c
tools/perf/ui/stdio/hist.c
tools/perf/util/hist.c
tools/perf/util/hist.h
tools/perf/util/sort.h