All of lore.kernel.org
 help / color / mirror / Atom feed
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,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v5 7/7] perf report: Show branch type in callchain entry
Date: Wed, 19 Apr 2017 16:15:38 +0200	[thread overview]
Message-ID: <20170419141538.GE19643@krava> (raw)
In-Reply-To: <1492616894-3635-8-git-send-email-yao.jin@linux.intel.com>

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

SNIP

> +static int count_str_printf(int index, const char *str,
> +	char *bf, int bfsize)
> +{
> +	int printed;
> +
> +	printed = scnprintf(bf, bfsize,
> +		"%s%s",
> +		(index) ? " " : " (", str);
> +
> +	return printed;
> +}
> +
> +static int branch_type_str(struct branch_type_stat *stat,
> +			   char *bf, int bfsize)
> +{
> +	int i, j = 0, printed = 0;
> +	u64 total = 0;
> +
> +	for (i = 0; i < PERF_BR_MAX; i++)
> +		total += stat->counts[i];
> +
> +	if (total == 0)
> +		return 0;
> +
> +	if (stat->jcc_fwd > 0)
> +		printed += count_str_printf(j++, "JCC forward",
> +				bf + printed, bfsize - printed);
> +
> +	if (stat->jcc_bwd > 0)
> +		printed += count_str_printf(j++, "JCC backward",
> +				bf + printed, bfsize - printed);
> +
> +	for (i = 0; i < PERF_BR_MAX; i++) {
> +		if (i == PERF_BR_JCC)
> +			continue;
> +
> +		if (stat->counts[i] > 0)
> +			printed += count_str_printf(j++, branch_type_name(i),
> +					bf + printed, bfsize - printed);
> +	}
> +
> +	if (stat->cross_4k > 0)
> +		printed += count_str_printf(j++, "CROSS_4K",
> +				bf + printed, bfsize - printed);
> +
> +	if (stat->cross_2m > 0)
> +		printed += count_str_printf(j++, "CROSS_2M",
> +				bf + printed, bfsize - printed);
> +
> +	return printed;
> +}

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

thanks,
jirka

      parent reply	other threads:[~2017-04-19 14:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 15:48 [PATCH v5 0/7] perf report: Show branch type Jin Yao
2017-04-19 15:48 ` [PATCH v5 1/7] perf/core: Define the common branch type classification Jin Yao
2017-04-19 15:48 ` [PATCH v5 2/7] perf/x86/intel: Record branch type Jin Yao
2017-04-19 15:48 ` [PATCH v5 3/7] perf record: Create a new option save_type in --branch-filter Jin Yao
2017-04-19 15:48 ` [PATCH v5 4/7] perf report: Refactor the branch info printing code Jin Yao
2017-04-19 14:15   ` Jiri Olsa
2017-04-19 14:15   ` Jiri Olsa
2017-04-19 15:48 ` [PATCH v5 5/7] perf util: Create branch.c/.h for common branch functions Jin Yao
2017-04-19 15:48 ` [PATCH v5 6/7] perf report: Show branch type statistics for stdio mode Jin Yao
2017-04-19 14:15   ` Jiri Olsa
2017-04-19 14:15   ` Jiri Olsa
2017-04-19 15:48 ` [PATCH v5 7/7] perf report: Show branch type in callchain entry Jin Yao
2017-04-19 14:15   ` Jiri Olsa
2017-04-20  0:36     ` Jin, Yao
2017-04-19 14:15   ` Jiri Olsa [this message]

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=20170419141538.GE19643@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=linuxppc-dev@lists.ozlabs.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.