From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757639AbdJKPCp (ORCPT ); Wed, 11 Oct 2017 11:02:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40372 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751811AbdJKPCk (ORCPT ); Wed, 11 Oct 2017 11:02:40 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F195B7F6A5 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=jolsa@kernel.org DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com F195B7F6A5 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , David Ahern , Peter Zijlstra , Andi Kleen Subject: [PATCH 20/35] perf annotate: Remove disasm__calc_percent from annotate_browser__calc_percent Date: Wed, 11 Oct 2017 17:01:43 +0200 Message-Id: <20171011150158.11895-21-jolsa@kernel.org> In-Reply-To: <20171011150158.11895-1-jolsa@kernel.org> References: <20171011150158.11895-1-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 11 Oct 2017 15:02:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Removing disasm__calc_percent from annotate_browser__calc_percent, because we already have the data calculated in struct annotation_line. Link: http://lkml.kernel.org/n/tip-ombkavh1jluozzkzewdbbuqy@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/ui/browsers/annotate.c | 22 ++++++---------------- tools/perf/util/annotate.c | 2 +- tools/perf/util/annotate.h | 1 + 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index b122d0a4e1ad..7d2de47a5bbb 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -437,15 +437,12 @@ static void annotate_browser__set_rb_top(struct annotate_browser *browser, browser->curr_hot = nd; } -static void annotate_browser__calc_percent(struct annotate_browser *browser, - struct perf_evsel *evsel) +static void annotate_browser__calc_percent(struct annotate_browser *browser) { struct map_symbol *ms = browser->b.priv; struct symbol *sym = ms->sym; struct annotation *notes = symbol__annotation(sym); - struct annotation_line *next; struct disasm_line *pos; - s64 len = symbol__size(sym); browser->entries = RB_ROOT; @@ -453,7 +450,6 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser, list_for_each_entry(pos, ¬es->src->source, al.node) { struct browser_disasm_line *bpos = disasm_line__browser(pos); - const char *path = NULL; double max_percent = 0.0; int i; @@ -462,17 +458,11 @@ static void annotate_browser__calc_percent(struct annotate_browser *browser, continue; } - next = annotation_line__next(&pos->al, ¬es->src->source); - for (i = 0; i < browser->nr_events; i++) { - struct sym_hist_entry sample; + struct annotation_data *sample = &pos->al.samples[i]; - bpos->samples[i].percent = disasm__calc_percent(notes, - evsel->idx + i, - pos->al.offset, - next ? next->offset : len, - &path, &sample); - bpos->samples[i].he = sample; + bpos->samples[i].percent = sample->percent; + bpos->samples[i].he = sample->he; if (max_percent < bpos->samples[i].percent) max_percent = bpos->samples[i].percent; @@ -780,7 +770,7 @@ static int annotate_browser__run(struct annotate_browser *browser, if (ui_browser__show(&browser->b, title, help) < 0) return -1; - annotate_browser__calc_percent(browser, evsel); + annotate_browser__calc_percent(browser); if (browser->curr_hot) { annotate_browser__set_rb_top(browser, browser->curr_hot); @@ -793,7 +783,7 @@ static int annotate_browser__run(struct annotate_browser *browser, key = ui_browser__run(&browser->b, delay_secs); if (delay_secs != 0) { - annotate_browser__calc_percent(browser, evsel); + annotate_browser__calc_percent(browser); /* * Current line focus got out of the list of most active * lines, NULL it so that if TAB|UNTAB is pressed, we diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index b16d012f8120..0dcf742e8659 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1642,7 +1642,7 @@ static int annotation__calc_percent(struct annotation *notes, return 0; } -static int symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel) +int symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel) { struct annotation *notes = symbol__annotation(sym); diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 1ec66a49e8de..ae87fe951f67 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -108,6 +108,7 @@ int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool r size_t disasm__fprintf(struct list_head *head, FILE *fp); double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset, s64 end, const char **path, struct sym_hist_entry *sample); +int symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel); struct sym_hist { u64 nr_samples; -- 2.13.6