All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] perf report: Name events in stats for pipe mode
@ 2024-08-27 21:27 Ian Rogers
  2024-08-28 17:06 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2024-08-27 21:27 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Kan Liang, linux-perf-users,
	linux-kernel

In stats mode PERF_RECORD_EVENT_UPDATE isn't being handled meaning the
evsels aren't named when handling pipe mode output.

Before:
```
$ perf record -e inst_retired.any -a -o - sleep 0.1|perf report --stats -i -
...
Aggregated stats:
           TOTAL events:      23358
            COMM events:       2608  (11.2%)
            EXIT events:          1  ( 0.0%)
            FORK events:       2607  (11.2%)
          SAMPLE events:        174  ( 0.7%)
           MMAP2 events:      17936  (76.8%)
            ATTR events:          2  ( 0.0%)
  FINISHED_ROUND events:          2  ( 0.0%)
        ID_INDEX events:          1  ( 0.0%)
      THREAD_MAP events:          1  ( 0.0%)
         CPU_MAP events:          1  ( 0.0%)
    EVENT_UPDATE events:          3  ( 0.0%)
       TIME_CONV events:          1  ( 0.0%)
         FEATURE events:         20  ( 0.1%)
   FINISHED_INIT events:          1  ( 0.0%)
raw 0xc0 stats:
          SAMPLE events:        174
```

After:
```
$ perf record -e inst_retired.any -a -o - sleep 0.1|perf report --stats -i -
...
Aggregated stats:
           TOTAL events:      23742
            COMM events:       2620  (11.0%)
            EXIT events:          2  ( 0.0%)
            FORK events:       2619  (11.0%)
          SAMPLE events:        165  ( 0.7%)
           MMAP2 events:      18304  (77.1%)
            ATTR events:          2  ( 0.0%)
  FINISHED_ROUND events:          2  ( 0.0%)
        ID_INDEX events:          1  ( 0.0%)
      THREAD_MAP events:          1  ( 0.0%)
         CPU_MAP events:          1  ( 0.0%)
    EVENT_UPDATE events:          3  ( 0.0%)
       TIME_CONV events:          1  ( 0.0%)
         FEATURE events:         20  ( 0.1%)
   FINISHED_INIT events:          1  ( 0.0%)
inst_retired.any stats:
          SAMPLE events:        165
```

This makes the pipe output match the regular output.

Signed-off-by: Ian Rogers <irogers@google.com>
---
This bug pre-dates commit 113f614c6dd0 ("perf report: Use
perf_tool__init()")
---
 tools/perf/builtin-report.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1643113616f4..5c21ca33ca08 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -811,6 +811,7 @@ static void stats_setup(struct report *rep)
 	rep->tool.attr = process_attr;
 	rep->tool.sample = count_sample_event;
 	rep->tool.lost_samples = count_lost_samples_event;
+	rep->tool.event_update = perf_event__process_event_update;
 	rep->tool.no_warn = true;
 }
 
-- 
2.46.0.295.g3b9ea8a38a-goog


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

* Re: [PATCH v1] perf report: Name events in stats for pipe mode
  2024-08-27 21:27 [PATCH v1] perf report: Name events in stats for pipe mode Ian Rogers
@ 2024-08-28 17:06 ` Namhyung Kim
  2024-08-28 20:53   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2024-08-28 17:06 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Kan Liang, linux-perf-users, linux-kernel

Hi Ian,

On Tue, Aug 27, 2024 at 2:37 PM Ian Rogers <irogers@google.com> wrote:
>
> In stats mode PERF_RECORD_EVENT_UPDATE isn't being handled meaning the
> evsels aren't named when handling pipe mode output.
>
> Before:
> ```
> $ perf record -e inst_retired.any -a -o - sleep 0.1|perf report --stats -i -
> ...
> Aggregated stats:
>            TOTAL events:      23358
>             COMM events:       2608  (11.2%)
>             EXIT events:          1  ( 0.0%)
>             FORK events:       2607  (11.2%)
>           SAMPLE events:        174  ( 0.7%)
>            MMAP2 events:      17936  (76.8%)
>             ATTR events:          2  ( 0.0%)
>   FINISHED_ROUND events:          2  ( 0.0%)
>         ID_INDEX events:          1  ( 0.0%)
>       THREAD_MAP events:          1  ( 0.0%)
>          CPU_MAP events:          1  ( 0.0%)
>     EVENT_UPDATE events:          3  ( 0.0%)
>        TIME_CONV events:          1  ( 0.0%)
>          FEATURE events:         20  ( 0.1%)
>    FINISHED_INIT events:          1  ( 0.0%)
> raw 0xc0 stats:
>           SAMPLE events:        174
> ```
>
> After:
> ```
> $ perf record -e inst_retired.any -a -o - sleep 0.1|perf report --stats -i -
> ...
> Aggregated stats:
>            TOTAL events:      23742
>             COMM events:       2620  (11.0%)
>             EXIT events:          2  ( 0.0%)
>             FORK events:       2619  (11.0%)
>           SAMPLE events:        165  ( 0.7%)
>            MMAP2 events:      18304  (77.1%)
>             ATTR events:          2  ( 0.0%)
>   FINISHED_ROUND events:          2  ( 0.0%)
>         ID_INDEX events:          1  ( 0.0%)
>       THREAD_MAP events:          1  ( 0.0%)
>          CPU_MAP events:          1  ( 0.0%)
>     EVENT_UPDATE events:          3  ( 0.0%)
>        TIME_CONV events:          1  ( 0.0%)
>          FEATURE events:         20  ( 0.1%)
>    FINISHED_INIT events:          1  ( 0.0%)
> inst_retired.any stats:
>           SAMPLE events:        165
> ```
>
> This makes the pipe output match the regular output.
>
> Signed-off-by: Ian Rogers <irogers@google.com>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

> ---
> This bug pre-dates commit 113f614c6dd0 ("perf report: Use
> perf_tool__init()")
> ---
>  tools/perf/builtin-report.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 1643113616f4..5c21ca33ca08 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -811,6 +811,7 @@ static void stats_setup(struct report *rep)
>         rep->tool.attr = process_attr;
>         rep->tool.sample = count_sample_event;
>         rep->tool.lost_samples = count_lost_samples_event;
> +       rep->tool.event_update = perf_event__process_event_update;
>         rep->tool.no_warn = true;
>  }
>
> --
> 2.46.0.295.g3b9ea8a38a-goog
>

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

* Re: [PATCH v1] perf report: Name events in stats for pipe mode
  2024-08-28 17:06 ` Namhyung Kim
@ 2024-08-28 20:53   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-08-28 20:53 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ian Rogers, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Kan Liang,
	linux-perf-users, linux-kernel

On Wed, Aug 28, 2024 at 10:06:37AM -0700, Namhyung Kim wrote:
> Hi Ian,
> 
> On Tue, Aug 27, 2024 at 2:37 PM Ian Rogers <irogers@google.com> wrote:
> >
> > In stats mode PERF_RECORD_EVENT_UPDATE isn't being handled meaning the
> > evsels aren't named when handling pipe mode output.
> >
> > Before:
> > ```
> > $ perf record -e inst_retired.any -a -o - sleep 0.1|perf report --stats -i -
> > ...
> > Aggregated stats:
> >            TOTAL events:      23358
> >             COMM events:       2608  (11.2%)
> >             EXIT events:          1  ( 0.0%)
> >             FORK events:       2607  (11.2%)
> >           SAMPLE events:        174  ( 0.7%)
> >            MMAP2 events:      17936  (76.8%)
> >             ATTR events:          2  ( 0.0%)
> >   FINISHED_ROUND events:          2  ( 0.0%)
> >         ID_INDEX events:          1  ( 0.0%)
> >       THREAD_MAP events:          1  ( 0.0%)
> >          CPU_MAP events:          1  ( 0.0%)
> >     EVENT_UPDATE events:          3  ( 0.0%)
> >        TIME_CONV events:          1  ( 0.0%)
> >          FEATURE events:         20  ( 0.1%)
> >    FINISHED_INIT events:          1  ( 0.0%)
> > raw 0xc0 stats:
> >           SAMPLE events:        174
> > ```
> >
> > After:
> > ```
> > $ perf record -e inst_retired.any -a -o - sleep 0.1|perf report --stats -i -
> > ...
> > Aggregated stats:
> >            TOTAL events:      23742
> >             COMM events:       2620  (11.0%)
> >             EXIT events:          2  ( 0.0%)
> >             FORK events:       2619  (11.0%)
> >           SAMPLE events:        165  ( 0.7%)
> >            MMAP2 events:      18304  (77.1%)
> >             ATTR events:          2  ( 0.0%)
> >   FINISHED_ROUND events:          2  ( 0.0%)
> >         ID_INDEX events:          1  ( 0.0%)
> >       THREAD_MAP events:          1  ( 0.0%)
> >          CPU_MAP events:          1  ( 0.0%)
> >     EVENT_UPDATE events:          3  ( 0.0%)
> >        TIME_CONV events:          1  ( 0.0%)
> >          FEATURE events:         20  ( 0.1%)
> >    FINISHED_INIT events:          1  ( 0.0%)
> > inst_retired.any stats:
> >           SAMPLE events:        165
> > ```
> >
> > This makes the pipe output match the regular output.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks, applied to perf-tools-next,

- Arnaldo

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

end of thread, other threads:[~2024-08-28 20:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 21:27 [PATCH v1] perf report: Name events in stats for pipe mode Ian Rogers
2024-08-28 17:06 ` Namhyung Kim
2024-08-28 20:53   ` Arnaldo Carvalho de Melo

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.