perf session: Change add_hist_entry to take the tree root instead of session
authorEric B Munson <ebmunson@us.ibm.com>
Fri, 5 Mar 2010 15:51:06 +0000 (12:51 -0300)
committerIngo Molnar <mingo@elte.hu>
Wed, 10 Mar 2010 12:53:47 +0000 (13:53 +0100)
In order to minimize the impact of storing multiple events in a
report this function will now take the root of the histogram
tree so that the logic for selecting the proper tree can be
inserted before the call.

Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1267804269-22660-3-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/builtin-annotate.c
tools/perf/builtin-diff.c
tools/perf/builtin-report.c
tools/perf/util/hist.c
tools/perf/util/hist.h

index 5ec5de995872a262e398b20da5440921fb3e51f2..4b734c731e27c100134aef5777c004370d0f2120 100644 (file)
@@ -116,7 +116,7 @@ static int perf_session__add_hist_entry(struct perf_session *self,
                return 0;
        }
 
-       he = __perf_session__add_hist_entry(self, al, NULL, count, &hit);
+       he = __perf_session__add_hist_entry(&self->hists, al, NULL, count, &hit);
        if (he == NULL)
                return -ENOMEM;
 
index 18b3f505f9db947012bfb247791f6c0edc13082c..20df7352629be59dfd6931e70a4fddc630c2735b 100644 (file)
@@ -26,7 +26,8 @@ static int perf_session__add_hist_entry(struct perf_session *self,
                                        struct addr_location *al, u64 count)
 {
        bool hit;
-       struct hist_entry *he = __perf_session__add_hist_entry(self, al, NULL,
+       struct hist_entry *he = __perf_session__add_hist_entry(&self->hists,
+                                                              al, NULL,
                                                               count, &hit);
        if (he == NULL)
                return -ENOMEM;
index cfc655d40bb7b4a88f37c068aef908e76e408a4c..cd16e6a7d6d0d1222d455b494e384259e360c00b 100644 (file)
@@ -56,7 +56,8 @@ static int perf_session__add_hist_entry(struct perf_session *self,
        if ((sort__has_parent || symbol_conf.use_callchain) && chain)
                syms = perf_session__resolve_callchain(self, al->thread,
                                                       chain, &parent);
-       he = __perf_session__add_hist_entry(self, al, parent, count, &hit);
+       he = __perf_session__add_hist_entry(&self->hists, al, parent,
+                                           count, &hit);
        if (he == NULL)
                return -ENOMEM;
 
index e8daf5ca6fd20dee79b5652c61ad48f59d109e30..55dd9115d1b471e82f1d75002d15dc76f7f63373 100644 (file)
@@ -12,12 +12,12 @@ struct callchain_param      callchain_param = {
  * histogram, sorted on item, collects counts
  */
 
-struct hist_entry *__perf_session__add_hist_entry(struct perf_session *self,
+struct hist_entry *__perf_session__add_hist_entry(struct rb_root *hists,
                                                  struct addr_location *al,
                                                  struct symbol *sym_parent,
                                                  u64 count, bool *hit)
 {
-       struct rb_node **p = &self->hists.rb_node;
+       struct rb_node **p = &hists->rb_node;
        struct rb_node *parent = NULL;
        struct hist_entry *he;
        struct hist_entry entry = {
@@ -53,7 +53,7 @@ struct hist_entry *__perf_session__add_hist_entry(struct perf_session *self,
                return NULL;
        *he = entry;
        rb_link_node(&he->rb_node, parent, p);
-       rb_insert_color(&he->rb_node, &self->hists);
+       rb_insert_color(&he->rb_node, hists);
        *hit = false;
        return he;
 }
index e5f99b24048b4574e410f9ee8621e0a1638545ac..7b48590c3ee82d721c68d50d269ce91dae5513fa 100644 (file)
@@ -10,8 +10,9 @@ struct perf_session;
 struct hist_entry;
 struct addr_location;
 struct symbol;
+struct rb_root;
 
-struct hist_entry *__perf_session__add_hist_entry(struct perf_session *self,
+struct hist_entry *__perf_session__add_hist_entry(struct rb_root *hists,
                                                  struct addr_location *al,
                                                  struct symbol *parent,
                                                  u64 count, bool *hit);