Commit d403d0ac authored by Eric B Munson's avatar Eric B Munson Committed by Ingo Molnar

perf session: Change add_hist_entry to take the tree root instead of session

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: default avatarEric B Munson <ebmunson@us.ibm.com>
Signed-off-by: default avatarArnaldo 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: default avatarIngo Molnar <mingo@elte.hu>
parent 8907fd60
...@@ -116,7 +116,7 @@ static int perf_session__add_hist_entry(struct perf_session *self, ...@@ -116,7 +116,7 @@ static int perf_session__add_hist_entry(struct perf_session *self,
return 0; 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) if (he == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -26,7 +26,8 @@ static int perf_session__add_hist_entry(struct perf_session *self, ...@@ -26,7 +26,8 @@ static int perf_session__add_hist_entry(struct perf_session *self,
struct addr_location *al, u64 count) struct addr_location *al, u64 count)
{ {
bool hit; 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); count, &hit);
if (he == NULL) if (he == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -56,7 +56,8 @@ static int perf_session__add_hist_entry(struct perf_session *self, ...@@ -56,7 +56,8 @@ static int perf_session__add_hist_entry(struct perf_session *self,
if ((sort__has_parent || symbol_conf.use_callchain) && chain) if ((sort__has_parent || symbol_conf.use_callchain) && chain)
syms = perf_session__resolve_callchain(self, al->thread, syms = perf_session__resolve_callchain(self, al->thread,
chain, &parent); 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) if (he == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -12,12 +12,12 @@ struct callchain_param callchain_param = { ...@@ -12,12 +12,12 @@ struct callchain_param callchain_param = {
* histogram, sorted on item, collects counts * 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 addr_location *al,
struct symbol *sym_parent, struct symbol *sym_parent,
u64 count, bool *hit) 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 rb_node *parent = NULL;
struct hist_entry *he; struct hist_entry *he;
struct hist_entry entry = { struct hist_entry entry = {
...@@ -53,7 +53,7 @@ struct hist_entry *__perf_session__add_hist_entry(struct perf_session *self, ...@@ -53,7 +53,7 @@ struct hist_entry *__perf_session__add_hist_entry(struct perf_session *self,
return NULL; return NULL;
*he = entry; *he = entry;
rb_link_node(&he->rb_node, parent, p); 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; *hit = false;
return he; return he;
} }
......
...@@ -10,8 +10,9 @@ struct perf_session; ...@@ -10,8 +10,9 @@ struct perf_session;
struct hist_entry; struct hist_entry;
struct addr_location; struct addr_location;
struct symbol; 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 addr_location *al,
struct symbol *parent, struct symbol *parent,
u64 count, bool *hit); u64 count, bool *hit);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment