diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-25 15:05:36 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-25 15:05:36 -0400 |
commit | 293db47f4753f5746e5aaa998ceb24dff662cf7e (patch) | |
tree | 6a16cc0521a1e2a142b589865a27b3a886f14421 /tools | |
parent | 18b308d7994e0e2a360b979f159fa7d2b91a26b1 (diff) |
perf hists browser: replace rb_first() != NULL by !RB_EMPTY_ROOT()
Its way too stupid to use rb_first() for just caching if there are
children, use the cheaper RB_EMPTY_ROOT() instead.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index 39ba230972bb..e61355e6b2c5 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -129,16 +129,16 @@ static void callchain_node__init_have_children_rb_tree(struct callchain_node *se | |||
129 | for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) { | 129 | for (nd = rb_first(&self->rb_root); nd; nd = rb_next(nd)) { |
130 | struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node); | 130 | struct callchain_node *child = rb_entry(nd, struct callchain_node, rb_node); |
131 | struct callchain_list *chain; | 131 | struct callchain_list *chain; |
132 | int first = true; | 132 | bool first = true; |
133 | 133 | ||
134 | list_for_each_entry(chain, &child->val, list) { | 134 | list_for_each_entry(chain, &child->val, list) { |
135 | if (first) { | 135 | if (first) { |
136 | first = false; | 136 | first = false; |
137 | chain->ms.has_children = chain->list.next != &child->val || | 137 | chain->ms.has_children = chain->list.next != &child->val || |
138 | rb_first(&child->rb_root) != NULL; | 138 | !RB_EMPTY_ROOT(&child->rb_root); |
139 | } else | 139 | } else |
140 | chain->ms.has_children = chain->list.next == &child->val && | 140 | chain->ms.has_children = chain->list.next == &child->val && |
141 | rb_first(&child->rb_root) != NULL; | 141 | !RB_EMPTY_ROOT(&child->rb_root); |
142 | } | 142 | } |
143 | 143 | ||
144 | callchain_node__init_have_children_rb_tree(child); | 144 | callchain_node__init_have_children_rb_tree(child); |
@@ -150,7 +150,7 @@ static void callchain_node__init_have_children(struct callchain_node *self) | |||
150 | struct callchain_list *chain; | 150 | struct callchain_list *chain; |
151 | 151 | ||
152 | list_for_each_entry(chain, &self->val, list) | 152 | list_for_each_entry(chain, &self->val, list) |
153 | chain->ms.has_children = rb_first(&self->rb_root) != NULL; | 153 | chain->ms.has_children = !RB_EMPTY_ROOT(&self->rb_root); |
154 | 154 | ||
155 | callchain_node__init_have_children_rb_tree(self); | 155 | callchain_node__init_have_children_rb_tree(self); |
156 | } | 156 | } |
@@ -301,11 +301,11 @@ static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *self, | |||
301 | if (first) { | 301 | if (first) { |
302 | first = false; | 302 | first = false; |
303 | chain->ms.has_children = chain->list.next != &child->val || | 303 | chain->ms.has_children = chain->list.next != &child->val || |
304 | rb_first(&child->rb_root) != NULL; | 304 | !RB_EMPTY_ROOT(&child->rb_root); |
305 | } else { | 305 | } else { |
306 | extra_offset = LEVEL_OFFSET_STEP; | 306 | extra_offset = LEVEL_OFFSET_STEP; |
307 | chain->ms.has_children = chain->list.next == &child->val && | 307 | chain->ms.has_children = chain->list.next == &child->val && |
308 | rb_first(&child->rb_root) != NULL; | 308 | !RB_EMPTY_ROOT(&child->rb_root); |
309 | } | 309 | } |
310 | 310 | ||
311 | folded_sign = callchain_list__folded(chain); | 311 | folded_sign = callchain_list__folded(chain); |
@@ -381,7 +381,7 @@ static int hist_browser__show_callchain_node(struct hist_browser *self, | |||
381 | * probably when the callchain is created, so as not to | 381 | * probably when the callchain is created, so as not to |
382 | * traverse it all over again | 382 | * traverse it all over again |
383 | */ | 383 | */ |
384 | chain->ms.has_children = rb_first(&node->rb_root) != NULL; | 384 | chain->ms.has_children = !RB_EMPTY_ROOT(&node->rb_root); |
385 | folded_sign = callchain_list__folded(chain); | 385 | folded_sign = callchain_list__folded(chain); |
386 | 386 | ||
387 | if (*row_offset != 0) { | 387 | if (*row_offset != 0) { |