perf stat: always separate stalled cycles per insn
PATCH 1/1 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,,
--- tools/perf/util/stat-shadow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/stat-shadow.c +2 -1
@@ -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 )) {
Signature · 1 line
2.21.0
Quoted 16 lines · Cong Wang
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,,
Quoted 5 lines
Cc Andi Kleen <[email protected]>Cc Jiri Olsa <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Cong Wang <[email protected]>
thanks,
jirka
Quoted 21 lines
--- tools/perf/util/stat-shadow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/perf/util/stat-shadow.c +2
-1@@ -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 )) {Signature · 1 line
2.21.0
Quoted 18 lines · Jiri Olsa
Quoted 16 lines · Cong Wang
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,,
Quoted 7 lines
Quoted 5 lines
Cc Andi Kleen <[email protected]>Cc Jiri Olsa <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Cong Wang <[email protected]>Acked-by Jiri Olsa <[email protected]>
Thanks for reviewing it. Is there anyone takes this patch?
Em Tue, May 28, 2019 at 11:21:38AM -0700, Cong Wang escreveu:
Quoted 25 lines · Jiri Olsa
Quoted 24 lines · Cong Wang
Quoted 21 lines
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 <[email protected]>Cc Jiri Olsa <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Signed-off-by Cong Wang <[email protected]>
Quoted 3 lines
Quoted 1 line
Acked-by Jiri Olsa <[email protected]>Thanks for reviewing it. Is there anyone takes this patch?
Enough time, acked already, picking it.
- Arnaldo
Hi, Arnaldo
Quoted 5 lines · Arnaldo Carvalho de Melo
Em Tue, May 28, 2019 at 11:21:38AM -0700, Cong Wang escreveu:
Quoted 1 line
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.
Em Tue, Jul 16, 2019 at 12:24:41PM -0700, Cong Wang escreveu:
Quoted 5 lines
Hi, Arnaldo
Quoted 1 line · Arnaldo Carvalho de Melo
Quoted 7 lines
Quoted 4 lines
Em Tue, May 28, 2019 at 11:21:38AM -0700, Cong Wang escreveu:
Quoted 1 line
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
Quoted 7 lines · Arnaldo Carvalho de Melo
Em Tue, Jul 16, 2019 at 12:24:41PM -0700, Cong Wang escreveu:
Quoted 6 lines
Hi, Arnaldo
Quoted 2 lines · Arnaldo Carvalho de Melo
Em Tue, May 28, 2019 at 11:21:38AM -0700, Cong Wang escreveu:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
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
tip-bot for Cong Wang
merge bot[tip:perf/urgent] perf stat: Always separate stalled cycles per insn
In reply to Cong Wangperf stat: Always separate stalled cycles per insn
Commit-ID: 146540fb545b8464ba1be298e3392daca0d183a2 Gitweb: https://git.kernel.org/tip/146540fb545b8464ba1be298e3392daca0d183a2 Author: Cong Wang <[email protected]> AuthorDate: Fri, 17 May 2019 15:10:39 -0700 Committer: Arnaldo Carvalho de Melo <[email protected]> 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,,
--- tools/perf/util/stat-shadow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/stat-shadow.c +2 -1
@@ -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 )) {