From: Jiri Olsa <jolsa@redhat.com>
To: Jin Yao <yao.jin@linux.intel.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
mingo@redhat.com, alexander.shishkin@linux.intel.com,
Linux-kernel@vger.kernel.org, ak@linux.intel.com,
kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH 2/2] perf report: Display average IPC and IPC coverage per symbol
Date: Mon, 26 Nov 2018 10:53:41 +0100 [thread overview]
Message-ID: <20181126095341.GB18780@krava> (raw)
In-Reply-To: <1543225254-5858-3-git-send-email-yao.jin@linux.intel.com>
On Mon, Nov 26, 2018 at 05:40:54PM +0800, Jin Yao wrote:
SNIP
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index f96c005..94f62c8 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -13,6 +13,7 @@
> #include "strlist.h"
> #include <traceevent/event-parse.h>
> #include "mem-events.h"
> +#include "annotate.h"
> #include <linux/kernel.h>
>
> regex_t parent_regex;
> @@ -422,6 +423,47 @@ struct sort_entry sort_srcline_to = {
> .se_width_idx = HISTC_SRCLINE_TO,
> };
>
> +static int hist_entry__sym_ipc_snprintf(struct hist_entry *he, char *bf,
> + size_t size, unsigned int width)
> +{
> +
> + struct symbol *sym = he->ms.sym;
> + struct map *map = he->ms.map;
> + struct perf_evsel *evsel = hists_to_evsel(he->hists);
> + struct annotation *notes;
> + double ipc = 0.0, coverage = 0.0;
> + char tmp[64];
> +
> + if (!sym)
> + return repsep_snprintf(bf, size, "%-*s", width, "-");
> +
> + if (!sym->annotated &&
> + symbol__annotate2(sym, map, evsel, &annotation__default_options,
> + NULL) < 0) {
> + return 0;
> + }
> +
> + sym->annotated = true;
I don't like this being set in here.. please move it to
symbol__annotate2 or symbol__annotate, not sure which
one of these is the best fit
> + notes = symbol__annotation(sym);
> +
> + if (notes->hit_cycles)
> + ipc = notes->hit_insn / ((double)notes->hit_cycles);
> +
> + if (notes->total_insn)
> + coverage = notes->cover_insn * 100.0 /
> + ((double)notes->total_insn);
missing { } for multiline code in 'if' condition
thanks,
jirka
next prev parent reply other threads:[~2018-11-26 9:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-26 9:40 [PATCH 0/2] perf report/annotate: Support average IPC and IPC coverage for function Jin Yao
2018-11-26 9:40 ` [PATCH 1/2] perf annotate: Compute average IPC and IPC coverage per symbol Jin Yao
2018-11-26 9:40 ` [PATCH 2/2] perf report: Display " Jin Yao
2018-11-26 9:52 ` Jiri Olsa
2018-11-27 3:50 ` Jin, Yao
2018-11-26 9:53 ` Jiri Olsa [this message]
2018-11-27 3:52 ` Jin, Yao
2018-11-26 9:55 ` Jiri Olsa
2018-11-27 3:42 ` Jin, Yao
2018-11-27 9:34 ` Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181126095341.GB18780@krava \
--to=jolsa@redhat.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=yao.jin@intel.com \
--cc=yao.jin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox