Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1625549

Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry
Date 2017-04-18 21:00 +0200
Message-ID <txGw3-1bd-19@gated-at.bofh.it> (permalink)
References <tv4XU-8aE-5@gated-at.bofh.it> <tv4XV-8aE-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Apr 12, 2017 at 06:21:06AM +0800, Jin Yao wrote:

SNIP

>  static int counts_str_build(char *bf, int bfsize,
>  			     u64 branch_count, u64 predicted_count,
>  			     u64 abort_count, u64 cycles_count,
> -			     u64 iter_count, u64 samples_count)
> +			     u64 iter_count, u64 samples_count,
> +			     struct branch_type_stat *brtype_stat)
>  {
> -	double predicted_percent = 0.0;
> -	const char *null_str = "";
> -	char iter_str[32];
> -	char cycle_str[32];
> -	char *istr, *cstr;
>  	u64 cycles;
> +	int printed, i = 0;
>  
>  	if (branch_count == 0)
>  		return scnprintf(bf, bfsize, " (calltrace)");
>  
> +	printed = branch_type_str(brtype_stat, bf, bfsize);
> +	if (printed)
> +		i++;
> +
>  	cycles = cycles_count / branch_count;
> +	if (cycles) {
> +		if (i++)
> +			printed += scnprintf(bf + printed, bfsize - printed,
> +				" cycles:%" PRId64 "", cycles);
> +		else
> +			printed += scnprintf(bf + printed, bfsize - printed,
> +				" (cycles:%" PRId64 "", cycles);
> +	}
>  
>  	if (iter_count && samples_count) {
> -		if (cycles > 0)
> -			scnprintf(iter_str, sizeof(iter_str),
> -				 " iterations:%" PRId64 "",
> -				 iter_count / samples_count);
> +		if (i++)
> +			printed += scnprintf(bf + printed, bfsize - printed,
> +				" iterations:%" PRId64 "",
> +				iter_count / samples_count);
>  		else
> -			scnprintf(iter_str, sizeof(iter_str),
> -				 "iterations:%" PRId64 "",
> -				 iter_count / samples_count);
> -		istr = iter_str;

could you please put the change from using iter_str
to bf into separate patch before the actual branch
display change?

it's hard to see if anything is broken ;-)

thanks,
jirka

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/5] perf report: Show branch type Jin Yao <yao.jin@linux.intel.com> - 2017-04-11 16:30 +0200
  [PATCH v4 2/5] perf/x86/intel: Record branch type Jin Yao <yao.jin@linux.intel.com> - 2017-04-11 16:30 +0200
  [PATCH v4 1/5] perf/core: Define the common branch type classification Jin Yao <yao.jin@linux.intel.com> - 2017-04-11 16:30 +0200
  [PATCH v4 5/5] perf report: Show branch type in callchain entry Jin Yao <yao.jin@linux.intel.com> - 2017-04-11 16:30 +0200
    Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry Jiri Olsa <jolsa@redhat.com> - 2017-04-18 21:00 +0200
      Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-19 02:40 +0200
    Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry Jiri Olsa <jolsa@redhat.com> - 2017-04-18 21:00 +0200
      Re: [PATCH v4 5/5] perf report: Show branch type in callchain entry "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-19 02:40 +0200
  Re: [PATCH v4 0/5] perf report: Show branch type Jiri Olsa <jolsa@redhat.com> - 2017-04-12 13:00 +0200
    Re: [PATCH v4 0/5] perf report: Show branch type "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-12 14:30 +0200
      Re: [PATCH v4 0/5] perf report: Show branch type Jiri Olsa <jolsa@redhat.com> - 2017-04-12 16:30 +0200
        Re: [PATCH v4 0/5] perf report: Show branch type Jiri Olsa <jolsa@redhat.com> - 2017-04-12 17:50 +0200
        Re: [PATCH v4 0/5] perf report: Show branch type "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-12 17:50 +0200
    Re: [PATCH v4 0/5] perf report: Show branch type "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-13 04:10 +0200
      Re: [PATCH v4 0/5] perf report: Show branch type "Jin, Yao" <yao.jin@linux.intel.com> - 2017-04-13 05:30 +0200
        Re: [PATCH v4 0/5] perf report: Show branch type Jiri Olsa <jolsa@redhat.com> - 2017-04-13 10:30 +0200

csiph-web