All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] perf stat: always separate stalled cycles per insn
@ 2019-05-17 22:10 Cong Wang
  2019-05-20  6:59 ` Jiri Olsa
  2019-07-23 21:50 ` [tip:perf/urgent] perf stat: Always " tip-bot for Cong Wang
  0 siblings, 2 replies; 8+ messages in thread
From: Cong Wang @ 2019-05-17 22:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: Cong Wang, Andi Kleen, Jiri Olsa, Ingo Molnar, Arnaldo Carvalho de Melo

The "stalled cycles per insn" is appended to "instructions" when
the CPU has this hardware counter directly. We should always make it
a separate line, which also aligns to the output when we hit the
"if (total && avg)" branch.

Before:
$ sudo perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
4565048704,,instructions,64114578096,100.00,1.34,insn per cycle,,
3396325133,,cycles,64146628546,100.00,,

After:
$ sudo ./tools/perf/perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
6721924,,instructions,24026790339,100.00,0.22,insn per cycle
,,,,,0.00,stalled cycles per insn
30939953,,cycles,24025512526,100.00,,

Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 tools/perf/util/stat-shadow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 83d8094be4fe..5c5e012e99c4 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -800,7 +800,8 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
 					"stalled cycles per insn",
 					ratio);
 		} else if (have_frontend_stalled) {
-			print_metric(config, ctxp, NULL, NULL,
+			out->new_line(config, ctxp);
+			print_metric(config, ctxp, NULL, "%7.2f ",
 				     "stalled cycles per insn", 0);
 		}
 	} else if (perf_evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)) {
-- 
2.21.0


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

* Re: [Patch] perf stat: always separate stalled cycles per insn
  2019-05-17 22:10 [Patch] perf stat: always separate stalled cycles per insn Cong Wang
@ 2019-05-20  6:59 ` Jiri Olsa
  2019-05-28 18:21   ` Cong Wang
  2019-07-23 21:50 ` [tip:perf/urgent] perf stat: Always " tip-bot for Cong Wang
  1 sibling, 1 reply; 8+ messages in thread
From: Jiri Olsa @ 2019-05-20  6:59 UTC (permalink / raw)
  To: Cong Wang
  Cc: linux-kernel, Andi Kleen, Jiri Olsa, Ingo Molnar,
	Arnaldo Carvalho de Melo

On Fri, May 17, 2019 at 03:10:39PM -0700, Cong Wang wrote:
> The "stalled cycles per insn" is appended to "instructions" when
> the CPU has this hardware counter directly. We should always make it
> a separate line, which also aligns to the output when we hit the
> "if (total && avg)" branch.
> 
> Before:
> $ sudo perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
> 4565048704,,instructions,64114578096,100.00,1.34,insn per cycle,,
> 3396325133,,cycles,64146628546,100.00,,
> 
> After:
> $ sudo ./tools/perf/perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
> 6721924,,instructions,24026790339,100.00,0.22,insn per cycle
> ,,,,,0.00,stalled cycles per insn
> 30939953,,cycles,24025512526,100.00,,
> 
> Cc: Andi Kleen <ak@linux.intel.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> ---
>  tools/perf/util/stat-shadow.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> index 83d8094be4fe..5c5e012e99c4 100644
> --- a/tools/perf/util/stat-shadow.c
> +++ b/tools/perf/util/stat-shadow.c
> @@ -800,7 +800,8 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
>  					"stalled cycles per insn",
>  					ratio);
>  		} else if (have_frontend_stalled) {
> -			print_metric(config, ctxp, NULL, NULL,
> +			out->new_line(config, ctxp);
> +			print_metric(config, ctxp, NULL, "%7.2f ",
>  				     "stalled cycles per insn", 0);
>  		}
>  	} else if (perf_evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)) {
> -- 
> 2.21.0
> 

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

* Re: [Patch] perf stat: always separate stalled cycles per insn
  2019-05-20  6:59 ` Jiri Olsa
@ 2019-05-28 18:21   ` Cong Wang
  2019-05-28 19:11     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: Cong Wang @ 2019-05-28 18:21 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: LKML, Andi Kleen, Jiri Olsa, Ingo Molnar, Arnaldo Carvalho de Melo

On Sun, May 19, 2019 at 11:59 PM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Fri, May 17, 2019 at 03:10:39PM -0700, Cong Wang wrote:
> > The "stalled cycles per insn" is appended to "instructions" when
> > the CPU has this hardware counter directly. We should always make it
> > a separate line, which also aligns to the output when we hit the
> > "if (total && avg)" branch.
> >
> > Before:
> > $ sudo perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
> > 4565048704,,instructions,64114578096,100.00,1.34,insn per cycle,,
> > 3396325133,,cycles,64146628546,100.00,,
> >
> > After:
> > $ sudo ./tools/perf/perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
> > 6721924,,instructions,24026790339,100.00,0.22,insn per cycle
> > ,,,,,0.00,stalled cycles per insn
> > 30939953,,cycles,24025512526,100.00,,
> >
> > Cc: Andi Kleen <ak@linux.intel.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> > Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
>
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Thanks for reviewing it. Is there anyone takes this patch?

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

* Re: [Patch] perf stat: always separate stalled cycles per insn
  2019-05-28 18:21   ` Cong Wang
@ 2019-05-28 19:11     ` Arnaldo Carvalho de Melo
  2019-07-16 19:24       ` Cong Wang
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-05-28 19:11 UTC (permalink / raw)
  To: Cong Wang; +Cc: Jiri Olsa, LKML, Andi Kleen, Jiri Olsa, Ingo Molnar

Em Tue, May 28, 2019 at 11:21:38AM -0700, Cong Wang escreveu:
> On Sun, May 19, 2019 at 11:59 PM Jiri Olsa <jolsa@redhat.com> wrote:
> >
> > On Fri, May 17, 2019 at 03:10:39PM -0700, Cong Wang wrote:
> > > The "stalled cycles per insn" is appended to "instructions" when
> > > the CPU has this hardware counter directly. We should always make it
> > > a separate line, which also aligns to the output when we hit the
> > > "if (total && avg)" branch.
> > >
> > > Before:
> > > $ sudo perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
> > > 4565048704,,instructions,64114578096,100.00,1.34,insn per cycle,,
> > > 3396325133,,cycles,64146628546,100.00,,
> > >
> > > After:
> > > $ sudo ./tools/perf/perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
> > > 6721924,,instructions,24026790339,100.00,0.22,insn per cycle
> > > ,,,,,0.00,stalled cycles per insn
> > > 30939953,,cycles,24025512526,100.00,,
> > >
> > > Cc: Andi Kleen <ak@linux.intel.com>
> > > Cc: Jiri Olsa <jolsa@kernel.org>
> > > Cc: Ingo Molnar <mingo@redhat.com>
> > > Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> > > Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> >
> > Acked-by: Jiri Olsa <jolsa@kernel.org>
> 
> Thanks for reviewing it. Is there anyone takes this patch?

Enough time, acked already, picking it.

- Arnaldo

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

* Re: [Patch] perf stat: always separate stalled cycles per insn
  2019-05-28 19:11     ` Arnaldo Carvalho de Melo
@ 2019-07-16 19:24       ` Cong Wang
  2019-07-16 20:43         ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 8+ messages in thread
From: Cong Wang @ 2019-07-16 19:24 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, LKML, Andi Kleen, Jiri Olsa, Ingo Molnar

Hi, Arnaldo

On Tue, May 28, 2019 at 12:11 PM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Tue, May 28, 2019 at 11:21:38AM -0700, Cong Wang escreveu:
> > Thanks for reviewing it. Is there anyone takes this patch?
>
> Enough time, acked already, picking it.

Where is this patch landed? I don't see it in Linus tree. I guess you
are still holding it somewhere?

Thanks.

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

* Re: [Patch] perf stat: always separate stalled cycles per insn
  2019-07-16 19:24       ` Cong Wang
@ 2019-07-16 20:43         ` Arnaldo Carvalho de Melo
  2019-07-17 15:40           ` Andi Kleen
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-16 20:43 UTC (permalink / raw)
  To: Cong Wang
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, LKML, Andi Kleen, Jiri Olsa,
	Ingo Molnar

Em Tue, Jul 16, 2019 at 12:24:41PM -0700, Cong Wang escreveu:
> Hi, Arnaldo
> 
> On Tue, May 28, 2019 at 12:11 PM Arnaldo Carvalho de Melo
> <arnaldo.melo@gmail.com> wrote:
> >
> > Em Tue, May 28, 2019 at 11:21:38AM -0700, Cong Wang escreveu:
> > > Thanks for reviewing it. Is there anyone takes this patch?
> >
> > Enough time, acked already, picking it.
> 
> Where is this patch landed? I don't see it in Linus tree. I guess you
> are still holding it somewhere?

Got it now, will push upstream in the next batch, sorry for the delay.

- Arnaldo

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

* Re: [Patch] perf stat: always separate stalled cycles per insn
  2019-07-16 20:43         ` Arnaldo Carvalho de Melo
@ 2019-07-17 15:40           ` Andi Kleen
  0 siblings, 0 replies; 8+ messages in thread
From: Andi Kleen @ 2019-07-17 15:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Cong Wang, Jiri Olsa, LKML, Jiri Olsa, Ingo Molnar

On Tue, Jul 16, 2019 at 05:43:24PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jul 16, 2019 at 12:24:41PM -0700, Cong Wang escreveu:
> > Hi, Arnaldo
> > 
> > On Tue, May 28, 2019 at 12:11 PM Arnaldo Carvalho de Melo
> > <arnaldo.melo@gmail.com> wrote:
> > >
> > > Em Tue, May 28, 2019 at 11:21:38AM -0700, Cong Wang escreveu:
> > > > Thanks for reviewing it. Is there anyone takes this patch?
> > >
> > > Enough time, acked already, picking it.
> > 
> > Where is this patch landed? I don't see it in Linus tree. I guess you
> > are still holding it somewhere?
> 
> Got it now, will push upstream in the next batch, sorry for the delay.

FWIW i would prefer to deprecate the stalled cycles metrics. They 
are confusing and misleading. --topdown FrontendBound is a much
better metric.

-Andi

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

* [tip:perf/urgent] perf stat: Always separate stalled cycles per insn
  2019-05-17 22:10 [Patch] perf stat: always separate stalled cycles per insn Cong Wang
  2019-05-20  6:59 ` Jiri Olsa
@ 2019-07-23 21:50 ` tip-bot for Cong Wang
  1 sibling, 0 replies; 8+ messages in thread
From: tip-bot for Cong Wang @ 2019-07-23 21:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mingo, hpa, acme, tglx, xiyou.wangcong, ak, jolsa

Commit-ID:  146540fb545b8464ba1be298e3392daca0d183a2
Gitweb:     https://git.kernel.org/tip/146540fb545b8464ba1be298e3392daca0d183a2
Author:     Cong Wang <xiyou.wangcong@gmail.com>
AuthorDate: Fri, 17 May 2019 15:10:39 -0700
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 23 Jul 2019 09:03:46 -0300

perf stat: Always separate stalled cycles per insn

The "stalled cycles per insn" is appended to "instructions" when the CPU
has this hardware counter directly. We should always make it a separate
line, which also aligns to the output when we hit the "if (total &&
avg)" branch.

Before:

  $ sudo perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
  4565048704,,instructions,64114578096,100.00,1.34,insn per cycle,,
  3396325133,,cycles,64146628546,100.00,,

After:

  $ sudo ./tools/perf/perf stat --all-cpus --field-separator , --log-fd 1 -einstructions,cycles -- sleep 1
  6721924,,instructions,24026790339,100.00,0.22,insn per cycle
  ,,,,,0.00,stalled cycles per insn
  30939953,,cycles,24025512526,100.00,,

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/20190517221039.8975-1-xiyou.wangcong@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/stat-shadow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 656065af4971..accb1bf1cfd8 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -819,7 +819,8 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
 					"stalled cycles per insn",
 					ratio);
 		} else if (have_frontend_stalled) {
-			print_metric(config, ctxp, NULL, NULL,
+			out->new_line(config, ctxp);
+			print_metric(config, ctxp, NULL, "%7.2f ",
 				     "stalled cycles per insn", 0);
 		}
 	} else if (perf_evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)) {

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

end of thread, other threads:[~2019-07-23 21:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-17 22:10 [Patch] perf stat: always separate stalled cycles per insn Cong Wang
2019-05-20  6:59 ` Jiri Olsa
2019-05-28 18:21   ` Cong Wang
2019-05-28 19:11     ` Arnaldo Carvalho de Melo
2019-07-16 19:24       ` Cong Wang
2019-07-16 20:43         ` Arnaldo Carvalho de Melo
2019-07-17 15:40           ` Andi Kleen
2019-07-23 21:50 ` [tip:perf/urgent] perf stat: Always " tip-bot for Cong Wang

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.