* [PATCH] perf stat: Fix no metric header if --per-socket and --metric-only set
@ 2020-03-31 18:02 Jin Yao
2020-04-03 9:45 ` Jiri Olsa
2020-04-16 8:31 ` [tip: perf/urgent] " tip-bot2 for Jin Yao
0 siblings, 2 replies; 4+ messages in thread
From: Jin Yao @ 2020-03-31 18:02 UTC (permalink / raw)
To: acme, jolsa, peterz, mingo, alexander.shishkin
Cc: Linux-kernel, ak, kan.liang, yao.jin, Jin Yao
We received a report that was no metric header displayed if --per-socket
and --metric-only were both set.
It's hard for script to parse the perf-stat output. This patch fixes this
issue.
Before:
root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
^C
Performance counter stats for 'system wide':
S0 8 2.6
2.215270071 seconds time elapsed
root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
# time socket cpus
1.000411692 S0 8 2.2
2.001547952 S0 8 3.4
3.002446511 S0 8 3.4
4.003346157 S0 8 4.0
5.004245736 S0 8 0.3
After:
root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
^C
Performance counter stats for 'system wide':
CPI
S0 8 2.1
1.813579830 seconds time elapsed
root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
# time socket cpus CPI
1.000415122 S0 8 3.2
2.001630051 S0 8 2.9
3.002612278 S0 8 4.3
4.003523594 S0 8 3.0
5.004504256 S0 8 3.7
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
tools/perf/util/stat-shadow.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 0fd713d3674f..03ecb8cd0eec 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -803,8 +803,11 @@ static void generic_metric(struct perf_stat_config *config,
out->force_header ?
(metric_name ? metric_name : name) : "", 0);
}
- } else
- print_metric(config, ctxp, NULL, NULL, "", 0);
+ } else {
+ print_metric(config, ctxp, NULL, NULL,
+ out->force_header ?
+ (metric_name ? metric_name : name) : "", 0);
+ }
for (i = 1; i < pctx.num_ids; i++)
zfree(&pctx.ids[i].name);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf stat: Fix no metric header if --per-socket and --metric-only set
2020-03-31 18:02 [PATCH] perf stat: Fix no metric header if --per-socket and --metric-only set Jin Yao
@ 2020-04-03 9:45 ` Jiri Olsa
2020-04-06 14:12 ` Arnaldo Carvalho de Melo
2020-04-16 8:31 ` [tip: perf/urgent] " tip-bot2 for Jin Yao
1 sibling, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2020-04-03 9:45 UTC (permalink / raw)
To: Jin Yao
Cc: acme, jolsa, peterz, mingo, alexander.shishkin, Linux-kernel, ak,
kan.liang, yao.jin
On Wed, Apr 01, 2020 at 02:02:26AM +0800, Jin Yao wrote:
> We received a report that was no metric header displayed if --per-socket
> and --metric-only were both set.
>
> It's hard for script to parse the perf-stat output. This patch fixes this
> issue.
>
> Before:
>
> root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
> ^C
> Performance counter stats for 'system wide':
>
> S0 8 2.6
>
> 2.215270071 seconds time elapsed
>
> root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
> # time socket cpus
> 1.000411692 S0 8 2.2
> 2.001547952 S0 8 3.4
> 3.002446511 S0 8 3.4
> 4.003346157 S0 8 4.0
> 5.004245736 S0 8 0.3
>
> After:
>
> root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
> ^C
> Performance counter stats for 'system wide':
>
> CPI
> S0 8 2.1
>
> 1.813579830 seconds time elapsed
>
> root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
> # time socket cpus CPI
> 1.000415122 S0 8 3.2
> 2.001630051 S0 8 2.9
> 3.002612278 S0 8 4.3
> 4.003523594 S0 8 3.0
> 5.004504256 S0 8 3.7
>
> Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
thanks,
jirka
> ---
> tools/perf/util/stat-shadow.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> index 0fd713d3674f..03ecb8cd0eec 100644
> --- a/tools/perf/util/stat-shadow.c
> +++ b/tools/perf/util/stat-shadow.c
> @@ -803,8 +803,11 @@ static void generic_metric(struct perf_stat_config *config,
> out->force_header ?
> (metric_name ? metric_name : name) : "", 0);
> }
> - } else
> - print_metric(config, ctxp, NULL, NULL, "", 0);
> + } else {
> + print_metric(config, ctxp, NULL, NULL,
> + out->force_header ?
> + (metric_name ? metric_name : name) : "", 0);
> + }
>
> for (i = 1; i < pctx.num_ids; i++)
> zfree(&pctx.ids[i].name);
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf stat: Fix no metric header if --per-socket and --metric-only set
2020-04-03 9:45 ` Jiri Olsa
@ 2020-04-06 14:12 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-04-06 14:12 UTC (permalink / raw)
To: Jiri Olsa
Cc: Jin Yao, jolsa, peterz, mingo, alexander.shishkin, Linux-kernel,
ak, kan.liang, yao.jin
Em Fri, Apr 03, 2020 at 11:45:00AM +0200, Jiri Olsa escreveu:
> On Wed, Apr 01, 2020 at 02:02:26AM +0800, Jin Yao wrote:
> > We received a report that was no metric header displayed if --per-socket
> > and --metric-only were both set.
> >
> > It's hard for script to parse the perf-stat output. This patch fixes this
> > issue.
> >
> > Before:
> >
> > root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
> > ^C
> > Performance counter stats for 'system wide':
> >
> > S0 8 2.6
> >
> > 2.215270071 seconds time elapsed
> >
> > root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
> > # time socket cpus
> > 1.000411692 S0 8 2.2
> > 2.001547952 S0 8 3.4
> > 3.002446511 S0 8 3.4
> > 4.003346157 S0 8 4.0
> > 5.004245736 S0 8 0.3
> >
> > After:
> >
> > root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
> > ^C
> > Performance counter stats for 'system wide':
> >
> > CPI
> > S0 8 2.1
> >
> > 1.813579830 seconds time elapsed
> >
> > root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
> > # time socket cpus CPI
> > 1.000415122 S0 8 3.2
> > 2.001630051 S0 8 2.9
> > 3.002612278 S0 8 4.3
> > 4.003523594 S0 8 3.0
> > 5.004504256 S0 8 3.7
> >
> > Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
>
> Acked-by: Jiri Olsa <jolsa@redhat.com>
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: perf/urgent] perf stat: Fix no metric header if --per-socket and --metric-only set
2020-03-31 18:02 [PATCH] perf stat: Fix no metric header if --per-socket and --metric-only set Jin Yao
2020-04-03 9:45 ` Jiri Olsa
@ 2020-04-16 8:31 ` tip-bot2 for Jin Yao
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Jin Yao @ 2020-04-16 8:31 UTC (permalink / raw)
To: linux-tip-commits
Cc: Jin Yao, Jiri Olsa, Alexander Shishkin, Andi Kleen, Kan Liang,
Peter Zijlstra, Arnaldo Carvalho de Melo, x86, LKML
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: 8358f698ec9d8467ad00c045e4d83c3e4acc7db4
Gitweb: https://git.kernel.org/tip/8358f698ec9d8467ad00c045e4d83c3e4acc7db4
Author: Jin Yao <yao.jin@linux.intel.com>
AuthorDate: Wed, 01 Apr 2020 02:02:26 +08:00
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Tue, 14 Apr 2020 08:49:26 -03:00
perf stat: Fix no metric header if --per-socket and --metric-only set
We received a report that was no metric header displayed if --per-socket
and --metric-only were both set.
It's hard for script to parse the perf-stat output. This patch fixes this
issue.
Before:
root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
^C
Performance counter stats for 'system wide':
S0 8 2.6
2.215270071 seconds time elapsed
root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
# time socket cpus
1.000411692 S0 8 2.2
2.001547952 S0 8 3.4
3.002446511 S0 8 3.4
4.003346157 S0 8 4.0
5.004245736 S0 8 0.3
After:
root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
^C
Performance counter stats for 'system wide':
CPI
S0 8 2.1
1.813579830 seconds time elapsed
root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
# time socket cpus CPI
1.000415122 S0 8 3.2
2.001630051 S0 8 2.9
3.002612278 S0 8 4.3
4.003523594 S0 8 3.0
5.004504256 S0 8 3.7
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200331180226.25915-1-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/stat-shadow.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 0fd713d..03ecb8c 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -803,8 +803,11 @@ static void generic_metric(struct perf_stat_config *config,
out->force_header ?
(metric_name ? metric_name : name) : "", 0);
}
- } else
- print_metric(config, ctxp, NULL, NULL, "", 0);
+ } else {
+ print_metric(config, ctxp, NULL, NULL,
+ out->force_header ?
+ (metric_name ? metric_name : name) : "", 0);
+ }
for (i = 1; i < pctx.num_ids; i++)
zfree(&pctx.ids[i].name);
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-16 9:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-31 18:02 [PATCH] perf stat: Fix no metric header if --per-socket and --metric-only set Jin Yao
2020-04-03 9:45 ` Jiri Olsa
2020-04-06 14:12 ` Arnaldo Carvalho de Melo
2020-04-16 8:31 ` [tip: perf/urgent] " 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.