This is a preparation for perf report multi-thread support. When multi-thread is enable, each thread will have its own hists during the sample processing.
Signed-off-by: Namhyung Kim <namhy...@kernel.org> --- tools/perf/builtin-report.c | 1 + tools/perf/builtin-top.c | 1 + tools/perf/tests/hists_cumulate.c | 1 + tools/perf/tests/hists_filter.c | 1 + tools/perf/tests/hists_output.c | 1 + tools/perf/util/hist.c | 20 +++++++------------- tools/perf/util/hist.h | 1 + 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index decd9e8584b5..5e53eee5a9a7 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -140,6 +140,7 @@ static int process_sample_event(struct perf_tool *tool, struct addr_location al; struct hist_entry_iter iter = { .evsel = evsel, + .hists = evsel__hists(evsel), .sample = sample, .hide_unresolved = rep->hide_unresolved, .add_entry_cb = hist_iter__report_callback, diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 6b987424d015..ea6e7bd04f9a 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -776,6 +776,7 @@ static void perf_event__process_sample(struct perf_tool *tool, struct hists *hists = evsel__hists(evsel); struct hist_entry_iter iter = { .evsel = evsel, + .hists = evsel__hists(evsel), .sample = sample, .add_entry_cb = hist_iter__top_callback, }; diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c index 7d82c8be5e36..36f31f839b96 100644 --- a/tools/perf/tests/hists_cumulate.c +++ b/tools/perf/tests/hists_cumulate.c @@ -88,6 +88,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) }; struct hist_entry_iter iter = { .evsel = evsel, + .hists = evsel__hists(evsel), .sample = &sample, .hide_unresolved = false, }; diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c index ce48775e6ada..f8077b81b618 100644 --- a/tools/perf/tests/hists_filter.c +++ b/tools/perf/tests/hists_filter.c @@ -64,6 +64,7 @@ static int add_hist_entries(struct perf_evlist *evlist, }; struct hist_entry_iter iter = { .evsel = evsel, + .hists = evsel__hists(evsel), .sample = &sample, .ops = &hist_iter_normal, .hide_unresolved = false, diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c index adbebc852cc8..bf9efe145260 100644 --- a/tools/perf/tests/hists_output.c +++ b/tools/perf/tests/hists_output.c @@ -58,6 +58,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) }; struct hist_entry_iter iter = { .evsel = evsel, + .hists = evsel__hists(evsel), .sample = &sample, .ops = &hist_iter_normal, .hide_unresolved = false, diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index b492968913e1..c11f7fdc08fd 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -505,7 +505,7 @@ iter_add_single_mem_entry(struct hist_entry_iter *iter, struct addr_location *al u64 cost; struct mem_info *mi = iter->priv; struct perf_sample *sample = iter->sample; - struct hists *hists = evsel__hists(iter->evsel); + struct hists *hists = iter->hists; struct hist_entry *he; if (mi == NULL) @@ -535,8 +535,7 @@ static int iter_finish_mem_entry(struct hist_entry_iter *iter, struct addr_location *al __maybe_unused) { - struct perf_evsel *evsel = iter->evsel; - struct hists *hists = evsel__hists(evsel); + struct hists *hists = iter->hists; struct hist_entry *he = iter->he; int err = -EINVAL; @@ -608,8 +607,7 @@ static int iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *al) { struct branch_info *bi; - struct perf_evsel *evsel = iter->evsel; - struct hists *hists = evsel__hists(evsel); + struct hists *hists = iter->hists; struct hist_entry *he = NULL; int i = iter->curr; int err = 0; @@ -656,11 +654,10 @@ iter_prepare_normal_entry(struct hist_entry_iter *iter __maybe_unused, static int iter_add_single_normal_entry(struct hist_entry_iter *iter, struct addr_location *al) { - struct perf_evsel *evsel = iter->evsel; struct perf_sample *sample = iter->sample; struct hist_entry *he; - he = __hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL, + he = __hists__add_entry(iter->hists, al, iter->parent, NULL, NULL, sample->period, sample->weight, sample->transaction, sample->time, true); if (he == NULL) @@ -675,7 +672,6 @@ iter_finish_normal_entry(struct hist_entry_iter *iter, struct addr_location *al __maybe_unused) { struct hist_entry *he = iter->he; - struct perf_evsel *evsel = iter->evsel; struct perf_sample *sample = iter->sample; if (he == NULL) @@ -683,7 +679,7 @@ iter_finish_normal_entry(struct hist_entry_iter *iter, iter->he = NULL; - hists__inc_nr_samples(evsel__hists(evsel), he->filtered); + hists__inc_nr_samples(iter->hists, he->filtered); return hist_entry__append_callchain(he, sample); } @@ -715,8 +711,7 @@ static int iter_add_single_cumulative_entry(struct hist_entry_iter *iter, struct addr_location *al) { - struct perf_evsel *evsel = iter->evsel; - struct hists *hists = evsel__hists(evsel); + struct hists *hists = iter->hists; struct perf_sample *sample = iter->sample; struct hist_entry **he_cache = iter->priv; struct hist_entry *he; @@ -761,7 +756,6 @@ static int iter_add_next_cumulative_entry(struct hist_entry_iter *iter, struct addr_location *al) { - struct perf_evsel *evsel = iter->evsel; struct perf_sample *sample = iter->sample; struct hist_entry **he_cache = iter->priv; struct hist_entry *he; @@ -795,7 +789,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, } } - he = __hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL, + he = __hists__add_entry(iter->hists, al, iter->parent, NULL, NULL, sample->period, sample->weight, sample->transaction, sample->time, false); if (he == NULL) diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index d47f6730f6a4..e5e7b7af6c56 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h @@ -86,6 +86,7 @@ struct hist_entry_iter { bool hide_unresolved; + struct hists *hists; struct perf_evsel *evsel; struct perf_sample *sample; struct hist_entry *he; -- 2.4.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/