diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-09 12:13:41 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-09 12:13:41 -0400 |
commit | 4ea062ed431d00153af0ac370cb6fef0620e5fa1 (patch) | |
tree | c4e7ad89b37d57751802524212291d1a8a89b7e3 /tools/perf/builtin-annotate.c | |
parent | 49c23f2d541ebf7ae5e9fff03301f4e7145cc979 (diff) |
perf evsel: Add hists helper
Not all tools need a hists instance per perf_evsel, so lets pave the way
to remove evsel->hists while leaving a way to access the hists from a
specially allocated evsel, one that comes with space at the end where
lives the evsel.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-qlktkhe31w4mgtbd84035sr2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index be5939418425..c9a119e2113d 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -51,6 +51,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, | |||
51 | struct addr_location *al, | 51 | struct addr_location *al, |
52 | struct perf_annotate *ann) | 52 | struct perf_annotate *ann) |
53 | { | 53 | { |
54 | struct hists *hists = evsel__hists(evsel); | ||
54 | struct hist_entry *he; | 55 | struct hist_entry *he; |
55 | int ret; | 56 | int ret; |
56 | 57 | ||
@@ -66,13 +67,12 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, | |||
66 | return 0; | 67 | return 0; |
67 | } | 68 | } |
68 | 69 | ||
69 | he = __hists__add_entry(&evsel->hists, al, NULL, NULL, NULL, 1, 1, 0, | 70 | he = __hists__add_entry(hists, al, NULL, NULL, NULL, 1, 1, 0, true); |
70 | true); | ||
71 | if (he == NULL) | 71 | if (he == NULL) |
72 | return -ENOMEM; | 72 | return -ENOMEM; |
73 | 73 | ||
74 | ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 74 | ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); |
75 | hists__inc_nr_samples(&evsel->hists, true); | 75 | hists__inc_nr_samples(hists, true); |
76 | return ret; | 76 | return ret; |
77 | } | 77 | } |
78 | 78 | ||
@@ -225,7 +225,7 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
225 | 225 | ||
226 | total_nr_samples = 0; | 226 | total_nr_samples = 0; |
227 | evlist__for_each(session->evlist, pos) { | 227 | evlist__for_each(session->evlist, pos) { |
228 | struct hists *hists = &pos->hists; | 228 | struct hists *hists = evsel__hists(pos); |
229 | u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; | 229 | u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; |
230 | 230 | ||
231 | if (nr_samples > 0) { | 231 | if (nr_samples > 0) { |