lkml.org 
[lkml]   [2012]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 09/15] perf hists: Let add_hist_entry to make a hist entry template
Date
From: Namhyung Kim <namhyung.kim@lge.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@fb.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.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


\
 
 \ /
  Last update: 2012-09-13 11:01    [W:0.146 / U:1.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site