[PATCH 30/38] perf hists: Pass hists struct to hist_entry_iter struct
From: Namhyung Kim
Date: Mon Mar 02 2015 - 22:13:43 EST
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 <namhyung@xxxxxxxxxx>
---
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 0d6e6bff7994..5adf269b84a9 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -138,6 +138,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,
.session = rep->session,
.hide_unresolved = rep->hide_unresolved,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index f33cb0e2aa0d..52c6d5d16ecb 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -775,6 +775,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,
.session = top->session,
.add_entry_cb = hist_iter__top_callback,
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index da64acbd35b7..273182c7cc12 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 f5c0c69383dc..67b9d498d731 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 4e3cff568eaa..541cf09280c1 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 dbe7f3744bf1..cbcfda5f1eac 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -510,7 +510,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)
@@ -540,8 +540,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;
@@ -613,8 +612,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;
@@ -661,11 +659,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)
@@ -680,7 +677,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)
@@ -688,7 +684,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);
}
@@ -720,8 +716,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;
@@ -766,7 +761,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;
@@ -800,7 +794,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 0afe15ba0277..6db118613ff5 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 perf_session *session;
--
2.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/