pref tools: Add missing map.h includes
[linux-2.6-block.git] / tools / perf / ui / browsers / hists.c
index ffac1d54a3d4cde8a00d6529a6754489106d1ac2..8ada0c690771889f8c40dfe24a9a64fba15b7e1b 100644 (file)
@@ -11,6 +11,7 @@
 #include "../../util/evsel.h"
 #include "../../util/evlist.h"
 #include "../../util/hist.h"
+#include "../../util/map.h"
 #include "../../util/pstack.h"
 #include "../../util/sort.h"
 #include "../../util/util.h"
@@ -49,7 +50,7 @@ static int hist_browser__get_folding(struct hist_browser *browser)
        struct hists *hists = browser->hists;
        int unfolded_rows = 0;
 
-       for (nd = rb_first(&hists->entries);
+       for (nd = rb_first_cached(&hists->entries);
             (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL;
             nd = rb_hierarchy_next(nd)) {
                struct hist_entry *he =
@@ -267,7 +268,7 @@ static int hierarchy_count_rows(struct hist_browser *hb, struct hist_entry *he,
        if (he->has_no_entry)
                return 1;
 
-       node = rb_first(&he->hroot_out);
+       node = rb_first_cached(&he->hroot_out);
        while (node) {
                float percent;
 
@@ -372,7 +373,7 @@ static void hist_entry__init_have_children(struct hist_entry *he)
                he->has_children = !RB_EMPTY_ROOT(&he->sorted_chain);
                callchain__init_have_children(&he->sorted_chain);
        } else {
-               he->has_children = !RB_EMPTY_ROOT(&he->hroot_out);
+               he->has_children = !RB_EMPTY_ROOT(&he->hroot_out.rb_root);
        }
 
        he->init_have_children = true;
@@ -508,7 +509,7 @@ static int hierarchy_set_folding(struct hist_browser *hb, struct hist_entry *he,
        struct hist_entry *child;
        int n = 0;
 
-       for (nd = rb_first(&he->hroot_out); nd; nd = rb_next(nd)) {
+       for (nd = rb_first_cached(&he->hroot_out); nd; nd = rb_next(nd)) {
                child = rb_entry(nd, struct hist_entry, rb_node);
                percent = hist_entry__get_percent_limit(child);
                if (!child->filtered && percent >= hb->min_pcnt)
@@ -566,7 +567,7 @@ __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
        struct rb_node *nd;
        struct hist_entry *he;
 
-       nd = rb_first(&browser->hists->entries);
+       nd = rb_first_cached(&browser->hists->entries);
        while (nd) {
                he = rb_entry(nd, struct hist_entry, rb_node);
 
@@ -1738,7 +1739,7 @@ static void ui_browser__hists_init_top(struct ui_browser *browser)
                struct hist_browser *hb;
 
                hb = container_of(browser, struct hist_browser, b);
-               browser->top = rb_first(&hb->hists->entries);
+               browser->top = rb_first_cached(&hb->hists->entries);
        }
 }
 
@@ -2649,7 +2650,7 @@ add_socket_opt(struct hist_browser *browser, struct popup_action *act,
 static void hist_browser__update_nr_entries(struct hist_browser *hb)
 {
        u64 nr_entries = 0;
-       struct rb_node *nd = rb_first(&hb->hists->entries);
+       struct rb_node *nd = rb_first_cached(&hb->hists->entries);
 
        if (hb->min_pcnt == 0 && !symbol_conf.report_hierarchy) {
                hb->nr_non_filtered_entries = hb->hists->nr_non_filtered_entries;
@@ -2669,7 +2670,7 @@ static void hist_browser__update_percent_limit(struct hist_browser *hb,
                                               double percent)
 {
        struct hist_entry *he;
-       struct rb_node *nd = rb_first(&hb->hists->entries);
+       struct rb_node *nd = rb_first_cached(&hb->hists->entries);
        u64 total = hists__total_period(hb->hists);
        u64 min_callchain_hits = total * (percent / 100);
 
@@ -2748,7 +2749,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
        "S             Zoom into current Processor Socket\n"            \
 
        /* help messages are sorted by lexical order of the hotkey */
-       const char report_help[] = HIST_BROWSER_HELP_COMMON
+       static const char report_help[] = HIST_BROWSER_HELP_COMMON
        "i             Show header information\n"
        "P             Print histograms to perf.hist.N\n"
        "r             Run available scripts\n"
@@ -2756,7 +2757,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
        "t             Zoom into current Thread\n"
        "V             Verbose (DSO names in callchains, etc)\n"
        "/             Filter symbol by name";
-       const char top_help[] = HIST_BROWSER_HELP_COMMON
+       static const char top_help[] = HIST_BROWSER_HELP_COMMON
        "P             Print histograms to perf.hist.N\n"
        "t             Zoom into current Thread\n"
        "V             Verbose (DSO names in callchains, etc)\n"