Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1404513 > unrolled thread
| Started by | Andi Kleen <andi@firstfloor.org> |
|---|---|
| First post | 2016-05-20 16:40 +0200 |
| Last post | 2016-05-20 22:00 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] perf stat: Print topology/time headers with --metric-only Andi Kleen <andi@firstfloor.org> - 2016-05-20 16:40 +0200
Re: [PATCH] perf stat: Print topology/time headers with --metric-only Jiri Olsa <jolsa@redhat.com> - 2016-05-20 17:40 +0200
Re: [PATCH] perf stat: Print topology/time headers with --metric-only Andi Kleen <ak@linux.intel.com> - 2016-05-20 17:50 +0200
Re: [PATCH] perf stat: Print topology/time headers with --metric-only Jiri Olsa <jolsa@redhat.com> - 2016-05-20 17:50 +0200
Re: [PATCH] perf stat: Print topology/time headers with --metric-only Andi Kleen <ak@linux.intel.com> - 2016-05-20 22:00 +0200
| From | Andi Kleen <andi@firstfloor.org> |
|---|---|
| Date | 2016-05-20 16:40 +0200 |
| Subject | [PATCH] perf stat: Print topology/time headers with --metric-only |
| Message-ID | <rATKO-6En-21@gated-at.bofh.it> |
From: Andi Kleen <ak@linux.intel.com>
When --metric-only is enabled there were no headers for the topology
in interval mode. Fix this here.
Before
$ perf stat --metric-only -e cycles,instructions -a -I 1000
1.000554967 insn per cycle stalled cycles per insn
1.000554967 0.27
2.000862000 0.24
3.001354948 0.25
After
$ perf stat --metric-only -e cycles,instructions -a -I 1000
1.000554967 insn per cycle stalled cycles per insn
1.000554967 0.27
2.000862000 0.24
3.001354948 0.25
Reported-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/builtin-stat.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 7c5c50b61b28..74d0849d728e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1347,23 +1347,38 @@ static void print_interval(char *prefix, struct timespec *ts)
sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep);
- if (num_print_interval == 0 && !csv_output && !metric_only) {
+ if (num_print_interval == 0 && !csv_output) {
switch (stat_config.aggr_mode) {
case AGGR_SOCKET:
- fprintf(output, "# time socket cpus counts %*s events\n", unit_width, "unit");
+ fprintf(output, "# time socket cpus");
+ if (!metric_only)
+ fprintf(output, " counts %*s events", unit_width, "unit");
+ fputc('\n', output);
break;
case AGGR_CORE:
- fprintf(output, "# time core cpus counts %*s events\n", unit_width, "unit");
+ fprintf(output, "# time core cpus");
+ if (!metric_only)
+ fprintf(output, " counts %*s events", unit_width, "unit");
+ fputc('\n', output);
break;
case AGGR_NONE:
- fprintf(output, "# time CPU counts %*s events\n", unit_width, "unit");
+ fprintf(output, "# time CPU");
+ if (!metric_only)
+ fprintf(output, " counts %*s events", unit_width, "unit");
+ fputc('\n', output);
break;
case AGGR_THREAD:
- fprintf(output, "# time comm-pid counts %*s events\n", unit_width, "unit");
+ fprintf(output, "# time comm-pid");
+ if (!metric_only)
+ fprintf(output, " counts %*s events\n", unit_width, "unit");
+ fputc('\n', output);
break;
case AGGR_GLOBAL:
default:
- fprintf(output, "# time counts %*s events\n", unit_width, "unit");
+ fprintf(output, "# time");
+ if (!metric_only)
+ fprintf(output, " counts %*s events\n", unit_width, "unit");
+ fputc('\n', output);
case AGGR_UNSET:
break;
}
--
2.5.5
[toc] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2016-05-20 17:40 +0200 |
| Message-ID | <rAUGR-7fU-1@gated-at.bofh.it> |
| In reply to | #1404513 |
On Fri, May 20, 2016 at 07:29:59AM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> When --metric-only is enabled there were no headers for the topology
> in interval mode. Fix this here.
>
> Before
>
> $ perf stat --metric-only -e cycles,instructions -a -I 1000
> 1.000554967 insn per cycle stalled cycles per insn
> 1.000554967 0.27
> 2.000862000 0.24
> 3.001354948 0.25
>
> After
>
> $ perf stat --metric-only -e cycles,instructions -a -I 1000
> 1.000554967 insn per cycle stalled cycles per insn
> 1.000554967 0.27
> 2.000862000 0.24
> 3.001354948 0.25
hum, I'm getting something else:
[jolsa@ibm-x3650m4-01 perf]$ sudo ./perf stat --topdown -I 1000 -a
nmi_watchdog enabled with topdown. May give wrong results.
Disable with echo 0 > /proc/sys/kernel/nmi_watchdog
# time core cpus
1.001710838 retiring bad speculation frontend bound backend bound
1.001710838 S0-C0 2 38.1% -0.0% 58.8% 3.1%
1.001710838 S0-C1 2 38.0% 0.0% 59.4% 2.5%
[jolsa@ibm-x3650m4-01 perf]$ sudo ./perf stat --metric-only -e cycles,instructions -a -I 1000
# time
1.000756338 insn per cycle stalled cycles per insn
1.000756338 0.32
2.001155562 0.30
jirka
[toc] | [prev] | [next] | [standalone]
| From | Andi Kleen <ak@linux.intel.com> |
|---|---|
| Date | 2016-05-20 17:50 +0200 |
| Message-ID | <rAUQx-7ji-1@gated-at.bofh.it> |
| In reply to | #1404548 |
> hum, I'm getting something else: > > [jolsa@ibm-x3650m4-01 perf]$ sudo ./perf stat --topdown -I 1000 -a > nmi_watchdog enabled with topdown. May give wrong results. > Disable with echo 0 > /proc/sys/kernel/nmi_watchdog > # time core cpus > 1.001710838 retiring bad speculation frontend bound backend bound > 1.001710838 S0-C0 2 38.1% -0.0% 58.8% 3.1% > 1.001710838 S0-C1 2 38.0% 0.0% 59.4% 2.5% > > > [jolsa@ibm-x3650m4-01 perf]$ sudo ./perf stat --metric-only -e cycles,instructions -a -I 1000 > # time > 1.000756338 insn per cycle stalled cycles per insn > 1.000756338 0.32 > 2.001155562 0.30 Right sorry, that was me not cutting and pasting correctly. Your output is correct and intended. -Andi -- ak@linux.intel.com -- Speaking for myself only
[toc] | [prev] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2016-05-20 17:50 +0200 |
| Message-ID | <rAUQy-7ji-21@gated-at.bofh.it> |
| In reply to | #1404555 |
On Fri, May 20, 2016 at 08:43:19AM -0700, Andi Kleen wrote: > > hum, I'm getting something else: > > > > [jolsa@ibm-x3650m4-01 perf]$ sudo ./perf stat --topdown -I 1000 -a > > nmi_watchdog enabled with topdown. May give wrong results. > > Disable with echo 0 > /proc/sys/kernel/nmi_watchdog > > # time core cpus > > 1.001710838 retiring bad speculation frontend bound backend bound > > 1.001710838 S0-C0 2 38.1% -0.0% 58.8% 3.1% > > 1.001710838 S0-C1 2 38.0% 0.0% 59.4% 2.5% > > > > > > [jolsa@ibm-x3650m4-01 perf]$ sudo ./perf stat --metric-only -e cycles,instructions -a -I 1000 > > # time > > 1.000756338 insn per cycle stalled cycles per insn > > 1.000756338 0.32 > > 2.001155562 0.30 > > Right sorry, that was me not cutting and pasting correctly. > > Your output is correct and intended. hum, I dont think so.. headers should be on the same line, right? jirka
[toc] | [prev] | [next] | [standalone]
| From | Andi Kleen <ak@linux.intel.com> |
|---|---|
| Date | 2016-05-20 22:00 +0200 |
| Message-ID | <rAYKu-1Ao-23@gated-at.bofh.it> |
| In reply to | #1404558 |
On Fri, May 20, 2016 at 05:47:38PM +0200, Jiri Olsa wrote: > On Fri, May 20, 2016 at 08:43:19AM -0700, Andi Kleen wrote: > > > hum, I'm getting something else: > > > > > > [jolsa@ibm-x3650m4-01 perf]$ sudo ./perf stat --topdown -I 1000 -a > > > nmi_watchdog enabled with topdown. May give wrong results. > > > Disable with echo 0 > /proc/sys/kernel/nmi_watchdog > > > # time core cpus > > > 1.001710838 retiring bad speculation frontend bound backend bound > > > 1.001710838 S0-C0 2 38.1% -0.0% 58.8% 3.1% > > > 1.001710838 S0-C1 2 38.0% 0.0% 59.4% 2.5% > > > > > > > > > [jolsa@ibm-x3650m4-01 perf]$ sudo ./perf stat --metric-only -e cycles,instructions -a -I 1000 > > > # time > > > 1.000756338 insn per cycle stalled cycles per insn > > > 1.000756338 0.32 > > > 2.001155562 0.30 > > > > Right sorry, that was me not cutting and pasting correctly. > > > > Your output is correct and intended. > > hum, I dont think so.. headers should be on the same line, right? I posted new patches which move it to the same line, and also fix another bug I noticed. -Andi -- ak@linux.intel.com -- Speaking for myself only
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web