lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181126095341.GB18780@krava>
Date:   Mon, 26 Nov 2018 10:53:41 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Jin Yao <yao.jin@...ux.intel.com>
Cc:     acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com,
        Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com
Subject: Re: [PATCH 2/2] perf report: Display average IPC and IPC coverage
 per symbol

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ