From 41a4e6e2a0237e8ac895f43158ef7c91ab7af157 Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Thu, 31 Oct 2013 15:56:03 +0900 Subject: perf hists: Consolidate __hists__add_*entry() The __hists__add_{branch,mem}_entry() does almost the same thing that __hists__add_entry() does. Consolidate them into one. Signed-off-by: Namhyung Kim Acked-by: Jiri Olsa Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jiri Olsa Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Rodrigo Campos Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1383202576-28141-2-git-send-email-namhyung@kernel.org [ Fixup clash with new COMM infrastructure ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/hist.c | 75 +++++--------------------------------------------- tools/perf/util/hist.h | 18 ++---------- 2 files changed, 10 insertions(+), 83 deletions(-) (limited to 'tools/perf/util') diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 30793f9..822903e 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -407,73 +407,12 @@ out: return he; } -struct hist_entry *__hists__add_mem_entry(struct hists *hists, - struct addr_location *al, - struct symbol *sym_parent, - struct mem_info *mi, - u64 period, - u64 weight) -{ - struct hist_entry entry = { - .thread = al->thread, - .comm = thread__comm(al->thread), - .ms = { - .map = al->map, - .sym = al->sym, - }, - .stat = { - .period = period, - .weight = weight, - .nr_events = 1, - }, - .cpu = al->cpu, - .ip = al->addr, - .level = al->level, - .parent = sym_parent, - .filtered = symbol__parent_filter(sym_parent), - .hists = hists, - .mem_info = mi, - .branch_info = NULL, - }; - return add_hist_entry(hists, &entry, al, period, weight); -} - -struct hist_entry *__hists__add_branch_entry(struct hists *hists, - struct addr_location *al, - struct symbol *sym_parent, - struct branch_info *bi, - u64 period, - u64 weight) -{ - struct hist_entry entry = { - .thread = al->thread, - .comm = thread__comm(al->thread), - .ms = { - .map = bi->to.map, - .sym = bi->to.sym, - }, - .cpu = al->cpu, - .ip = bi->to.addr, - .level = al->level, - .stat = { - .period = period, - .nr_events = 1, - .weight = weight, - }, - .parent = sym_parent, - .filtered = symbol__parent_filter(sym_parent), - .branch_info = bi, - .hists = hists, - .mem_info = NULL, - }; - - return add_hist_entry(hists, &entry, al, period, weight); -} - struct hist_entry *__hists__add_entry(struct hists *hists, struct addr_location *al, - struct symbol *sym_parent, u64 period, - u64 weight, u64 transaction) + struct symbol *sym_parent, + struct branch_info *bi, + struct mem_info *mi, + u64 period, u64 weight, u64 transaction) { struct hist_entry entry = { .thread = al->thread, @@ -486,15 +425,15 @@ struct hist_entry *__hists__add_entry(struct hists *hists, .ip = al->addr, .level = al->level, .stat = { - .period = period, .nr_events = 1, + .period = period, .weight = weight, }, .parent = sym_parent, .filtered = symbol__parent_filter(sym_parent), .hists = hists, - .branch_info = NULL, - .mem_info = NULL, + .branch_info = bi, + .mem_info = mi, .transaction = transaction, }; diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 9d2d022..307f1c7 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@ -86,7 +86,9 @@ struct hists { struct hist_entry *__hists__add_entry(struct hists *self, struct addr_location *al, - struct symbol *parent, u64 period, + struct symbol *parent, + struct branch_info *bi, + struct mem_info *mi, u64 period, u64 weight, u64 transaction); int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right); @@ -95,20 +97,6 @@ int hist_entry__sort_snprintf(struct hist_entry *self, char *bf, size_t size, struct hists *hists); void hist_entry__free(struct hist_entry *); -struct hist_entry *__hists__add_branch_entry(struct hists *self, - struct addr_location *al, - struct symbol *sym_parent, - struct branch_info *bi, - u64 period, - u64 weight); - -struct hist_entry *__hists__add_mem_entry(struct hists *self, - struct addr_location *al, - struct symbol *sym_parent, - struct mem_info *mi, - u64 period, - u64 weight); - void hists__output_resort(struct hists *self); void hists__collapse_resort(struct hists *self, struct ui_progress *prog); -- cgit v1.1