Skip to content

Commit

Permalink
perf hists: Introduce hists__add_entry_ops function
Browse files Browse the repository at this point in the history
Introducing hists__add_entry_ops function to allow using the allocation
callbacks externally.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1467701765-26194-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Jul 12, 2016
1 parent f542e76 commit a505197
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
42 changes: 35 additions & 7 deletions tools/perf/util/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,13 +559,15 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists,
return he;
}

struct hist_entry *hists__add_entry(struct hists *hists,
struct addr_location *al,
struct symbol *sym_parent,
struct branch_info *bi,
struct mem_info *mi,
struct perf_sample *sample,
bool sample_self)
static struct hist_entry*
__hists__add_entry(struct hists *hists,
struct addr_location *al,
struct symbol *sym_parent,
struct branch_info *bi,
struct mem_info *mi,
struct perf_sample *sample,
bool sample_self,
struct hist_entry_ops *ops)
{
struct hist_entry entry = {
.thread = al->thread,
Expand All @@ -592,11 +594,37 @@ struct hist_entry *hists__add_entry(struct hists *hists,
.transaction = sample->transaction,
.raw_data = sample->raw_data,
.raw_size = sample->raw_size,
.ops = ops,
};

return hists__findnew_entry(hists, &entry, al, sample_self);
}

struct hist_entry *hists__add_entry(struct hists *hists,
struct addr_location *al,
struct symbol *sym_parent,
struct branch_info *bi,
struct mem_info *mi,
struct perf_sample *sample,
bool sample_self)
{
return __hists__add_entry(hists, al, sym_parent, bi, mi,
sample, sample_self, NULL);
}

struct hist_entry *hists__add_entry_ops(struct hists *hists,
struct hist_entry_ops *ops,
struct addr_location *al,
struct symbol *sym_parent,
struct branch_info *bi,
struct mem_info *mi,
struct perf_sample *sample,
bool sample_self)
{
return __hists__add_entry(hists, al, sym_parent, bi, mi,
sample, sample_self, ops);
}

static int
iter_next_nop_entry(struct hist_entry_iter *iter __maybe_unused,
struct addr_location *al __maybe_unused)
Expand Down
11 changes: 11 additions & 0 deletions tools/perf/util/hist.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "ui/progress.h"

struct hist_entry;
struct hist_entry_ops;
struct addr_location;
struct symbol;

Expand Down Expand Up @@ -127,6 +128,16 @@ struct hist_entry *hists__add_entry(struct hists *hists,
struct mem_info *mi,
struct perf_sample *sample,
bool sample_self);

struct hist_entry *hists__add_entry_ops(struct hists *hists,
struct hist_entry_ops *ops,
struct addr_location *al,
struct symbol *sym_parent,
struct branch_info *bi,
struct mem_info *mi,
struct perf_sample *sample,
bool sample_self);

int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
int max_stack_depth, void *arg);

Expand Down

0 comments on commit a505197

Please sign in to comment.