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]
Date:   Mon, 28 Aug 2017 11:19:26 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Andi Kleen <andi@...stfloor.org>
Cc:     acme@...nel.org, jolsa@...nel.org, linux-kernel@...r.kernel.org,
        Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v2 12/19] perf, tools, stat: Factor out generic metric
 printing

On Fri, Aug 11, 2017 at 04:26:27PM -0700, Andi Kleen wrote:

SNIP

> +static void generic_metric(const char *metric_expr,
> +			   struct perf_evsel **metric_events,
> +			   char *name,
> +			   const char *metric_name,
> +			   double avg,
> +			   int cpu,
> +			   int ctx,
> +			   struct perf_stat_output_ctx *out)
> +{
> +	print_metric_t print_metric = out->print_metric;
> +	struct parse_ctx pctx;
> +	double ratio;
> +	int i;
> +	void *ctxp = out->ctx;
> +
> +	expr__ctx_init(&pctx);
> +	expr__add_id(&pctx, name, avg);
> +	for (i = 0; metric_events[i]; i++) {
> +		struct saved_value *v;
> +
> +		v = saved_value_lookup(metric_events[i], cpu, ctx, false);
> +		if (!v)
> +			break;
> +		expr__add_id(&pctx, metric_events[i]->name, avg_stats(&v->stats));
> +	}
> +	if (!metric_events[i]) {
> +		const char *p = metric_expr;
> +
> +		if (expr__parse(&ratio, &pctx, &p) == 0)
> +			print_metric(ctxp, NULL, "%8.1f",
> +				metric_name ?
> +				metric_name :
> +			out->force_header ?  name : "",

nit, missing tab ^^^

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ