[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1347520811-28150-10-git-send-email-namhyung@kernel.org>
Date: Thu, 13 Sep 2012 16:20:05 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Arun Sharma <asharma@...com>, David Ahern <dsahern@...il.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung.kim@....com>
Subject: [PATCH 09/15] perf hists: Let add_hist_entry to make a hist entry template
From: Namhyung Kim <namhyung.kim@....com>
Change the add_hist_entry() to make a template based on given @al.
It makes the callchain cumulation code simpler.
Cc: Arun Sharma <asharma@...com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
tools/perf/util/hist.c | 50 +++++++++++++++++++++++++++++---------------------
1 file changed, 29 insertions(+), 21 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 46433a0830dd..f96298f59e49 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -299,10 +299,10 @@ static u8 symbol__parent_filter(const struct symbol *parent)
return 0;
}
-static struct hist_entry *add_hist_entry(struct hists *hists,
- struct hist_entry *entry,
- struct addr_location *al,
- u64 period, bool sample_self)
+static struct hist_entry *__add_hist_entry(struct hists *hists,
+ struct hist_entry *entry,
+ struct addr_location *al,
+ u64 period, bool sample_self)
{
struct rb_node **p;
struct rb_node *parent = NULL;
@@ -362,20 +362,19 @@ out_unlock:
return he;
}
-struct hist_entry *__hists__add_branch_entry(struct hists *self,
- struct addr_location *al,
- struct symbol *sym_parent,
- struct branch_info *bi,
- u64 period)
+static struct hist_entry *add_hist_entry(struct hists *hists,
+ struct addr_location *al,
+ struct symbol *sym_parent,
+ u64 period, bool sample_self)
{
struct hist_entry entry = {
.thread = al->thread,
.ms = {
- .map = bi->to.map,
- .sym = bi->to.sym,
+ .map = al->map,
+ .sym = al->sym,
},
.cpu = al->cpu,
- .ip = bi->to.addr,
+ .ip = al->addr,
.level = al->level,
.stat = {
.period = period,
@@ -383,24 +382,25 @@ struct hist_entry *__hists__add_branch_entry(struct hists *self,
},
.parent = sym_parent,
.filtered = symbol__parent_filter(sym_parent),
- .branch_info = bi,
};
- return add_hist_entry(self, &entry, al, period, true);
+ return __add_hist_entry(hists, &entry, al, period, sample_self);
}
-struct hist_entry *__hists__add_entry(struct hists *self,
- struct addr_location *al,
- struct symbol *sym_parent, u64 period)
+struct hist_entry *__hists__add_branch_entry(struct hists *self,
+ struct addr_location *al,
+ struct symbol *sym_parent,
+ struct branch_info *bi,
+ u64 period)
{
struct hist_entry entry = {
.thread = al->thread,
.ms = {
- .map = al->map,
- .sym = al->sym,
+ .map = bi->to.map,
+ .sym = bi->to.sym,
},
.cpu = al->cpu,
- .ip = al->addr,
+ .ip = bi->to.addr,
.level = al->level,
.stat = {
.period = period,
@@ -408,9 +408,17 @@ struct hist_entry *__hists__add_entry(struct hists *self,
},
.parent = sym_parent,
.filtered = symbol__parent_filter(sym_parent),
+ .branch_info = bi,
};
- return add_hist_entry(self, &entry, al, period, true);
+ return __add_hist_entry(self, &entry, al, period, true);
+}
+
+struct hist_entry *__hists__add_entry(struct hists *self,
+ struct addr_location *al,
+ struct symbol *sym_parent, u64 period)
+{
+ return add_hist_entry(self, al, sym_parent, period, true);
}
int64_t
--
1.7.11.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists