Re: [PATCH 6/7] perf hist: Use cached rbtrees

From: Davidlohr Bueso
Date: Tue Jan 22 2019 - 10:27:38 EST


On Tue, 22 Jan 2019, Arnaldo Carvalho de Melo wrote:

Em Thu, Dec 06, 2018 at 11:18:18AM -0800, Davidlohr Bueso escreveu:
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

CC /tmp/build/perf/util/hist.o
ui/browsers/hists.c: In function ???hierarchy_set_folding???:
ui/browsers/hists.c:511:21: error: passing argument 1 of ???rb_first??? from incompatible pointer type [-Werror=incompatible-pointer-types]
for (nd = rb_first(&he->hroot_out); nd; nd = rb_next(nd)) {
^~~~~~~~~~~~~~
In file included from ui/browsers/hists.c:8:
/home/acme/git/perf/tools/include/linux/rbtree.h:83:24: note: expected ???const struct rb_root *??? but argument is of type ???struct rb_root_cached *???
extern struct rb_node *rb_first(const struct rb_root *);
^~~~~~~~
ui/browsers/hists.c: In function ???__hist_browser__set_folding???:
ui/browsers/hists.c:569:16: error: passing argument 1 of ???rb_first??? from incompatible pointer type [-Werror=incompatible-pointer-types]
nd = rb_first(&browser->hists->entries);
^~~~~~~~~~~~~~~~~~~~~~~~

So I added this on top, please check:

Looks good thanks (sorry I thought I had tested all this -- even ran perf
several times :/)

Thanks,
Davidlohr