All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf report: Fix no branch type statistics report issue
@ 2020-03-13 13:46 Jin Yao
  2020-03-13 19:24 ` Arnaldo Carvalho de Melo
  2020-03-19 14:10 ` [tip: perf/core] " tip-bot2 for Jin Yao
  0 siblings, 2 replies; 3+ messages in thread
From: Jin Yao @ 2020-03-13 13:46 UTC (permalink / raw)
  To: acme, jolsa, peterz, mingo, alexander.shishkin
  Cc: Linux-kernel, ak, kan.liang, yao.jin, Jin Yao

Previously we could get the report of branch type statistics.

For example,

perf record -j any,save_type ...
perf report --stdio

  #
  # Branch Statistics:
  #
  COND_FWD:  40.6%
  COND_BWD:   4.1%
  CROSS_4K:  24.7%
  CROSS_2M:  12.3%
      COND:  44.7%
    UNCOND:   0.0%
       IND:   6.1%
      CALL:  24.5%
       RET:  24.7%

But now for the recent perf, it can't report the branch type statistics.

It's a regression issue caused by commit 40c39e304641
("perf report: Fix a no annotate browser displayed issue"),
which only counts the branch type statistics for browser mode.

This patch moves the branch_type_count() outside of ui__has_annotation()
checking, then branch type statistics can work for stdio mode.

Fixes: 40c39e304641 ("perf report: Fix a no annotate browser displayed issue")

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
 tools/perf/builtin-report.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d7c905f7520f..5f4045df76f4 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -186,24 +186,23 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
 {
 	struct hist_entry *he = iter->he;
 	struct report *rep = arg;
-	struct branch_info *bi;
+	struct branch_info *bi = he->branch_info;
 	struct perf_sample *sample = iter->sample;
 	struct evsel *evsel = iter->evsel;
 	int err;
 
+	branch_type_count(&rep->brtype_stat, &bi->flags,
+			  bi->from.addr, bi->to.addr);
+
 	if (!ui__has_annotation() && !rep->symbol_ipc)
 		return 0;
 
-	bi = he->branch_info;
 	err = addr_map_symbol__inc_samples(&bi->from, sample, evsel);
 	if (err)
 		goto out;
 
 	err = addr_map_symbol__inc_samples(&bi->to, sample, evsel);
 
-	branch_type_count(&rep->brtype_stat, &bi->flags,
-			  bi->from.addr, bi->to.addr);
-
 out:
 	return err;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf report: Fix no branch type statistics report issue
  2020-03-13 13:46 [PATCH] perf report: Fix no branch type statistics report issue Jin Yao
@ 2020-03-13 19:24 ` Arnaldo Carvalho de Melo
  2020-03-19 14:10 ` [tip: perf/core] " tip-bot2 for Jin Yao
  1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-03-13 19:24 UTC (permalink / raw)
  To: Jin Yao
  Cc: jolsa, peterz, mingo, alexander.shishkin, Linux-kernel, ak,
	kan.liang, yao.jin

Em Fri, Mar 13, 2020 at 09:46:07PM +0800, Jin Yao escreveu:
> Previously we could get the report of branch type statistics.
> 
> For example,
> 
> perf record -j any,save_type ...
> perf report --stdio
> 
>   #
>   # Branch Statistics:
>   #
>   COND_FWD:  40.6%
>   COND_BWD:   4.1%
>   CROSS_4K:  24.7%
>   CROSS_2M:  12.3%
>       COND:  44.7%
>     UNCOND:   0.0%
>        IND:   6.1%
>       CALL:  24.5%
>        RET:  24.7%
> 
> But now for the recent perf, it can't report the branch type statistics.
> 
> It's a regression issue caused by commit 40c39e304641
> ("perf report: Fix a no annotate browser displayed issue"),
> which only counts the branch type statistics for browser mode.
> 
> This patch moves the branch_type_count() outside of ui__has_annotation()
> checking, then branch type statistics can work for stdio mode.
> 
> Fixes: 40c39e304641 ("perf report: Fix a no annotate browser displayed issue")

Thanks, tested before/after, matches description, applied.

- Arnaldo
 
> Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> ---
>  tools/perf/builtin-report.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index d7c905f7520f..5f4045df76f4 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -186,24 +186,23 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
>  {
>  	struct hist_entry *he = iter->he;
>  	struct report *rep = arg;
> -	struct branch_info *bi;
> +	struct branch_info *bi = he->branch_info;
>  	struct perf_sample *sample = iter->sample;
>  	struct evsel *evsel = iter->evsel;
>  	int err;
>  
> +	branch_type_count(&rep->brtype_stat, &bi->flags,
> +			  bi->from.addr, bi->to.addr);
> +
>  	if (!ui__has_annotation() && !rep->symbol_ipc)
>  		return 0;
>  
> -	bi = he->branch_info;
>  	err = addr_map_symbol__inc_samples(&bi->from, sample, evsel);
>  	if (err)
>  		goto out;
>  
>  	err = addr_map_symbol__inc_samples(&bi->to, sample, evsel);
>  
> -	branch_type_count(&rep->brtype_stat, &bi->flags,
> -			  bi->from.addr, bi->to.addr);
> -
>  out:
>  	return err;
>  }
> -- 
> 2.17.1
> 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: perf/core] perf report: Fix no branch type statistics report issue
  2020-03-13 13:46 [PATCH] perf report: Fix no branch type statistics report issue Jin Yao
  2020-03-13 19:24 ` Arnaldo Carvalho de Melo
@ 2020-03-19 14:10 ` tip-bot2 for Jin Yao
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Jin Yao @ 2020-03-19 14:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Jin Yao, Alexander Shishkin, Andi Kleen, Jiri Olsa, Kan Liang,
	Peter Zijlstra, Arnaldo Carvalho de Melo, x86, LKML

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     c3b10649a80e9da2892c1fd3038c53abd57588f6
Gitweb:        https://git.kernel.org/tip/c3b10649a80e9da2892c1fd3038c53abd57588f6
Author:        Jin Yao <yao.jin@linux.intel.com>
AuthorDate:    Fri, 13 Mar 2020 21:46:07 +08:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Tue, 17 Mar 2020 18:01:40 -03:00

perf report: Fix no branch type statistics report issue

Previously we could get the report of branch type statistics.

For example:

  # perf record -j any,save_type ...
  # t perf report --stdio

  #
  # Branch Statistics:
  #
  COND_FWD:  40.6%
  COND_BWD:   4.1%
  CROSS_4K:  24.7%
  CROSS_2M:  12.3%
      COND:  44.7%
    UNCOND:   0.0%
       IND:   6.1%
      CALL:  24.5%
       RET:  24.7%

But now for the recent perf, it can't report the branch type statistics.

It's a regression issue caused by commit 40c39e304641 ("perf report: Fix
a no annotate browser displayed issue"), which only counts the branch
type statistics for browser mode.

This patch moves the branch_type_count() outside of ui__has_annotation()
checking, then branch type statistics can work for stdio mode.

Fixes: 40c39e304641 ("perf report: Fix a no annotate browser displayed issue")
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200313134607.12873-1-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c |  9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d7c905f..5f4045d 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -186,24 +186,23 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
 {
 	struct hist_entry *he = iter->he;
 	struct report *rep = arg;
-	struct branch_info *bi;
+	struct branch_info *bi = he->branch_info;
 	struct perf_sample *sample = iter->sample;
 	struct evsel *evsel = iter->evsel;
 	int err;
 
+	branch_type_count(&rep->brtype_stat, &bi->flags,
+			  bi->from.addr, bi->to.addr);
+
 	if (!ui__has_annotation() && !rep->symbol_ipc)
 		return 0;
 
-	bi = he->branch_info;
 	err = addr_map_symbol__inc_samples(&bi->from, sample, evsel);
 	if (err)
 		goto out;
 
 	err = addr_map_symbol__inc_samples(&bi->to, sample, evsel);
 
-	branch_type_count(&rep->brtype_stat, &bi->flags,
-			  bi->from.addr, bi->to.addr);
-
 out:
 	return err;
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-19 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 13:46 [PATCH] perf report: Fix no branch type statistics report issue Jin Yao
2020-03-13 19:24 ` Arnaldo Carvalho de Melo
2020-03-19 14:10 ` [tip: perf/core] " tip-bot2 for Jin Yao

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.