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: <20151104083456.GE29671@krava.brq.redhat.com>
Date:	Wed, 4 Nov 2015 09:34:56 +0100
From:	Jiri Olsa <jolsa@...hat.com>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	jolsa@...nel.org, acme@...nel.org, mingo@...nel.org,
	linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 3/9] perf, tools, stat: Abstract stat metrics printing

On Mon, Nov 02, 2015 at 05:50:22PM -0800, Andi Kleen wrote:

SNIP

> @@ -307,119 +302,145 @@ void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel,
>  		total = avg_stats(&runtime_cycles_stats[ctx][cpu]);
>  		if (total) {
>  			ratio = avg / total;
> -			fprintf(out, " #   %5.2f  insns per cycle        ", ratio);
> +			print_metric(ctxp, NULL, "%7.2f ",
> +					"insn per cycle", ratio);
>  		} else {
> -			fprintf(out, "                                   ");
> +			print_metric(ctxp, NULL, NULL, "insn per cycle", 0);
>  		}
>  		total = avg_stats(&runtime_stalled_cycles_front_stats[ctx][cpu]);
>  		total = max(total, avg_stats(&runtime_stalled_cycles_back_stats[ctx][cpu]));
>  
> +		out->new_line(ctxp);

I think this needs to be in the condition below (check patch below)
otherwise you'll get empty new line in case there's no stalled-cycles events

>  		if (total && avg) {
>  			ratio = total / avg;
> -			fprintf(out, "\n");
> -			if (aggr == AGGR_NONE)
> -				fprintf(out, "        ");
> -			fprintf(out, "                                                  #   %5.2f  stalled cycles per insn", ratio);
> +			print_metric(ctxp, NULL, "%7.2f ",
> +					"stalled cycles per insn",
> +					ratio);
> +		} else {
> +			print_metric(ctxp, NULL, NULL,
> +				     "stalled cycles per insn", 0);
>  		}

also I dont understand the reason for the else case in here

jirka

> -
> -	} else if (perf_evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES) &&
> -			runtime_branches_stats[ctx][cpu].n != 0) {
> -		print_branch_misses(out, cpu, evsel, avg);


---
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 4d8f18581b9b..367e220e93d5 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -310,8 +310,8 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
 		total = avg_stats(&runtime_stalled_cycles_front_stats[ctx][cpu]);
 		total = max(total, avg_stats(&runtime_stalled_cycles_back_stats[ctx][cpu]));
 
-		out->new_line(ctxp);
 		if (total && avg) {
+			out->new_line(ctxp);
 			ratio = total / avg;
 			print_metric(ctxp, NULL, "%7.2f ",
 					"stalled cycles per insn",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ