Re: [PATCH v5 6/7] perf report: Show branch type statistics for stdio mode

Jiri Olsa
2017-04-19T14:15:54Z

On Wed, Apr 19, 2017 at 11:48:13PM +0800, Jin Yao wrote:

SNIP

> +static void branch_type_stat_display(FILE *fp, struct branch_type_stat *stat)
> +{
> + u64 total = 0;
> + int i;
> +
> + for (i = 0; i < PERF_BR_MAX; i++)
> + total += stat->counts[i];
> +
> + if (total == 0)
> + return;
> +
> + fprintf(fp, "\n#");
> + fprintf(fp, "\n# Branch Statistics:");
> + fprintf(fp, "\n#");
> +
> + if (stat->jcc_fwd > 0)
> + fprintf(fp, "\n%12s: %5.1f%%",
> + "JCC forward",
> + 100.0 * (double)stat->jcc_fwd / (double)total);
> +
> + if (stat->jcc_bwd > 0)
> + fprintf(fp, "\n%12s: %5.1f%%",
> + "JCC backward",
> + 100.0 * (double)stat->jcc_bwd / (double)total);
> +
> + if (stat->cross_4k > 0)
> + fprintf(fp, "\n%12s: %5.1f%%",
> + "CROSS_4K",
> + 100.0 * (double)stat->cross_4k / (double)total);
> +
> + if (stat->cross_2m > 0)
> + fprintf(fp, "\n%12s: %5.1f%%",
> + "CROSS_2M",
> + 100.0 * (double)stat->cross_2m / (double)total);
> +
> + for (i = 0; i < PERF_BR_MAX; i++) {
> + if (stat->counts[i] > 0)
> + fprintf(fp, "\n%12s: %5.1f%%",
> + branch_type_name(i),
> + 100.0 *
> + (double)stat->counts[i] / (double)total);
> + }
> +}

could you please also move this one to that new branch.c file

thanks,
jirka