summaryrefslogtreecommitdiff
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-08-04 16:05:08 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-08-08 21:55:47 +0300
commit2bcf73069b0722c92a84c0fd57df542890a74904 (patch)
treea3c1c2e5e5ff130246c3a3d625fa9554c320f3e2 /tools/perf/util/annotate.c
parent48a1e4f2381387a097ea9f7897c5c32e9aaa708d (diff)
downloadlinux-2bcf73069b0722c92a84c0fd57df542890a74904.tar.xz
perf annotate: Loop group events directly in annotation__calc_percent()
We need to bring in 'struct hists' object and for that we need 'struct perf_evsel' object in the scope. Switching the group data loop with the evsel group loop. It does the same thing, but it brings evsel object, that we can use later get the 'struct hists' object. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/20180804130521.11408-8-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 728603636adc..34d4bb73aa84 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1774,13 +1774,14 @@ static void calc_percent(struct sym_hist *sym_hist,
}
static void annotation__calc_percent(struct annotation *notes,
- struct perf_evsel *evsel, s64 len)
+ struct perf_evsel *leader, s64 len)
{
struct annotation_line *al, *next;
+ struct perf_evsel *evsel;
list_for_each_entry(al, &notes->src->source, node) {
s64 end;
- int i;
+ int i = 0;
if (al->offset == -1)
continue;
@@ -1788,12 +1789,14 @@ static void annotation__calc_percent(struct annotation *notes,
next = annotation_line__next(al, &notes->src->source);
end = next ? next->offset : len;
- for (i = 0; i < al->data_nr; i++) {
+ for_each_group_evsel(evsel, leader) {
struct annotation_data *data;
struct sym_hist *sym_hist;
- sym_hist = annotation__histogram(notes, evsel->idx + i);
- data = &al->data[i];
+ BUG_ON(i >= al->data_nr);
+
+ sym_hist = annotation__histogram(notes, evsel->idx);
+ data = &al->data[i++];
calc_percent(sym_hist, data, al->offset, end);
}