diff options
author | Namhyung Kim <namhyung@kernel.org> | 2015-05-19 04:04:10 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-05-27 11:21:43 -0400 |
commit | 063bd9363bb8979b2939bdc0412d98a8ac062e3b (patch) | |
tree | bd9bda7ed06583eeabf2d376a2711f36fc97eea4 /tools | |
parent | 554e92ed8fcdbcad736ef906c393847d44d52692 (diff) |
perf hists: Reducing arguments of hist_entry_iter__add()
The evsel and sample arguments are to set iter for later use. As it
also receives an iter as another argument, just set them before calling
the function.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1432022650-18205-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-report.c | 9 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 7 | ||||
-rw-r--r-- | tools/perf/tests/hists_cumulate.c | 6 | ||||
-rw-r--r-- | tools/perf/tests/hists_filter.c | 4 | ||||
-rw-r--r-- | tools/perf/tests/hists_output.c | 6 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 8 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 1 |
7 files changed, 22 insertions, 19 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 92fca2157e5e..56025d90622f 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -139,8 +139,10 @@ static int process_sample_event(struct perf_tool *tool, | |||
139 | struct report *rep = container_of(tool, struct report, tool); | 139 | struct report *rep = container_of(tool, struct report, tool); |
140 | struct addr_location al; | 140 | struct addr_location al; |
141 | struct hist_entry_iter iter = { | 141 | struct hist_entry_iter iter = { |
142 | .hide_unresolved = rep->hide_unresolved, | 142 | .evsel = evsel, |
143 | .add_entry_cb = hist_iter__report_callback, | 143 | .sample = sample, |
144 | .hide_unresolved = rep->hide_unresolved, | ||
145 | .add_entry_cb = hist_iter__report_callback, | ||
144 | }; | 146 | }; |
145 | int ret = 0; | 147 | int ret = 0; |
146 | 148 | ||
@@ -168,8 +170,7 @@ static int process_sample_event(struct perf_tool *tool, | |||
168 | if (al.map != NULL) | 170 | if (al.map != NULL) |
169 | al.map->dso->hit = 1; | 171 | al.map->dso->hit = 1; |
170 | 172 | ||
171 | ret = hist_entry_iter__add(&iter, &al, evsel, sample, rep->max_stack, | 173 | ret = hist_entry_iter__add(&iter, &al, rep->max_stack, rep); |
172 | rep); | ||
173 | if (ret < 0) | 174 | if (ret < 0) |
174 | pr_debug("problem adding hist entry, skipping event\n"); | 175 | pr_debug("problem adding hist entry, skipping event\n"); |
175 | out_put: | 176 | out_put: |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index a19351728f0f..6b987424d015 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -775,7 +775,9 @@ static void perf_event__process_sample(struct perf_tool *tool, | |||
775 | if (al.sym == NULL || !al.sym->ignore) { | 775 | if (al.sym == NULL || !al.sym->ignore) { |
776 | struct hists *hists = evsel__hists(evsel); | 776 | struct hists *hists = evsel__hists(evsel); |
777 | struct hist_entry_iter iter = { | 777 | struct hist_entry_iter iter = { |
778 | .add_entry_cb = hist_iter__top_callback, | 778 | .evsel = evsel, |
779 | .sample = sample, | ||
780 | .add_entry_cb = hist_iter__top_callback, | ||
779 | }; | 781 | }; |
780 | 782 | ||
781 | if (symbol_conf.cumulate_callchain) | 783 | if (symbol_conf.cumulate_callchain) |
@@ -785,8 +787,7 @@ static void perf_event__process_sample(struct perf_tool *tool, | |||
785 | 787 | ||
786 | pthread_mutex_lock(&hists->lock); | 788 | pthread_mutex_lock(&hists->lock); |
787 | 789 | ||
788 | err = hist_entry_iter__add(&iter, &al, evsel, sample, | 790 | err = hist_entry_iter__add(&iter, &al, top->max_stack, top); |
789 | top->max_stack, top); | ||
790 | if (err < 0) | 791 | if (err < 0) |
791 | pr_err("Problem incrementing symbol period, skipping event\n"); | 792 | pr_err("Problem incrementing symbol period, skipping event\n"); |
792 | 793 | ||
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c index 620f626e5b35..7d82c8be5e36 100644 --- a/tools/perf/tests/hists_cumulate.c +++ b/tools/perf/tests/hists_cumulate.c | |||
@@ -87,6 +87,8 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) | |||
87 | }, | 87 | }, |
88 | }; | 88 | }; |
89 | struct hist_entry_iter iter = { | 89 | struct hist_entry_iter iter = { |
90 | .evsel = evsel, | ||
91 | .sample = &sample, | ||
90 | .hide_unresolved = false, | 92 | .hide_unresolved = false, |
91 | }; | 93 | }; |
92 | 94 | ||
@@ -104,8 +106,8 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) | |||
104 | &sample) < 0) | 106 | &sample) < 0) |
105 | goto out; | 107 | goto out; |
106 | 108 | ||
107 | if (hist_entry_iter__add(&iter, &al, evsel, &sample, | 109 | if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH, |
108 | PERF_MAX_STACK_DEPTH, NULL) < 0) { | 110 | NULL) < 0) { |
109 | addr_location__put(&al); | 111 | addr_location__put(&al); |
110 | goto out; | 112 | goto out; |
111 | } | 113 | } |
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c index 82e1ee52e024..ce48775e6ada 100644 --- a/tools/perf/tests/hists_filter.c +++ b/tools/perf/tests/hists_filter.c | |||
@@ -63,6 +63,8 @@ static int add_hist_entries(struct perf_evlist *evlist, | |||
63 | }, | 63 | }, |
64 | }; | 64 | }; |
65 | struct hist_entry_iter iter = { | 65 | struct hist_entry_iter iter = { |
66 | .evsel = evsel, | ||
67 | .sample = &sample, | ||
66 | .ops = &hist_iter_normal, | 68 | .ops = &hist_iter_normal, |
67 | .hide_unresolved = false, | 69 | .hide_unresolved = false, |
68 | }; | 70 | }; |
@@ -81,7 +83,7 @@ static int add_hist_entries(struct perf_evlist *evlist, | |||
81 | &sample) < 0) | 83 | &sample) < 0) |
82 | goto out; | 84 | goto out; |
83 | 85 | ||
84 | if (hist_entry_iter__add(&iter, &al, evsel, &sample, | 86 | if (hist_entry_iter__add(&iter, &al, |
85 | PERF_MAX_STACK_DEPTH, NULL) < 0) { | 87 | PERF_MAX_STACK_DEPTH, NULL) < 0) { |
86 | addr_location__put(&al); | 88 | addr_location__put(&al); |
87 | goto out; | 89 | goto out; |
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c index fd7ec4f9aeb4..adbebc852cc8 100644 --- a/tools/perf/tests/hists_output.c +++ b/tools/perf/tests/hists_output.c | |||
@@ -57,6 +57,8 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) | |||
57 | }, | 57 | }, |
58 | }; | 58 | }; |
59 | struct hist_entry_iter iter = { | 59 | struct hist_entry_iter iter = { |
60 | .evsel = evsel, | ||
61 | .sample = &sample, | ||
60 | .ops = &hist_iter_normal, | 62 | .ops = &hist_iter_normal, |
61 | .hide_unresolved = false, | 63 | .hide_unresolved = false, |
62 | }; | 64 | }; |
@@ -70,8 +72,8 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) | |||
70 | &sample) < 0) | 72 | &sample) < 0) |
71 | goto out; | 73 | goto out; |
72 | 74 | ||
73 | if (hist_entry_iter__add(&iter, &al, evsel, &sample, | 75 | if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH, |
74 | PERF_MAX_STACK_DEPTH, NULL) < 0) { | 76 | NULL) < 0) { |
75 | addr_location__put(&al); | 77 | addr_location__put(&al); |
76 | goto out; | 78 | goto out; |
77 | } | 79 | } |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 338770679863..2504b5b1a308 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -851,19 +851,15 @@ const struct hist_iter_ops hist_iter_cumulative = { | |||
851 | }; | 851 | }; |
852 | 852 | ||
853 | int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, | 853 | int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, |
854 | struct perf_evsel *evsel, struct perf_sample *sample, | ||
855 | int max_stack_depth, void *arg) | 854 | int max_stack_depth, void *arg) |
856 | { | 855 | { |
857 | int err, err2; | 856 | int err, err2; |
858 | 857 | ||
859 | err = sample__resolve_callchain(sample, &iter->parent, evsel, al, | 858 | err = sample__resolve_callchain(iter->sample, &iter->parent, |
860 | max_stack_depth); | 859 | iter->evsel, al, max_stack_depth); |
861 | if (err) | 860 | if (err) |
862 | return err; | 861 | return err; |
863 | 862 | ||
864 | iter->evsel = evsel; | ||
865 | iter->sample = sample; | ||
866 | |||
867 | err = iter->ops->prepare_entry(iter, al); | 863 | err = iter->ops->prepare_entry(iter, al); |
868 | if (err) | 864 | if (err) |
869 | goto out; | 865 | goto out; |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 9f31b89a527a..5ed8d9c22981 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -111,7 +111,6 @@ struct hist_entry *__hists__add_entry(struct hists *hists, | |||
111 | u64 weight, u64 transaction, | 111 | u64 weight, u64 transaction, |
112 | bool sample_self); | 112 | bool sample_self); |
113 | int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, | 113 | int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, |
114 | struct perf_evsel *evsel, struct perf_sample *sample, | ||
115 | int max_stack_depth, void *arg); | 114 | int max_stack_depth, void *arg); |
116 | 115 | ||
117 | int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); | 116 | int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right); |