* [PATCH] perf record: Display data size on pipe mode
@ 2024-01-12 23:13 Namhyung Kim
2024-02-07 3:43 ` Namhyung Kim
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Namhyung Kim @ 2024-01-12 23:13 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Jiri Olsa
Cc: Ian Rogers, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
Currently pipe mode doesn't set the file size and it results in a
misleading message of 0 data size at the end. Although it might miss
some accounting for pipe header or more, just displaying the data size
would reduce the possible confusion.
Before:
$ perf record -o- perf test -w noploop | perf report -i- -q --percent-limit=1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB - ] <====== (here)
99.58% perf perf [.] noploop
After:
$ perf record -o- perf test -w noploop | perf report -i- -q --percent-limit=1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.229 MB - ]
99.46% perf perf [.] noploop
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-record.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 91e6828c38cc..21ebcb04f1d8 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1773,8 +1773,11 @@ record__finish_output(struct record *rec)
struct perf_data *data = &rec->data;
int fd = perf_data__fd(data);
- if (data->is_pipe)
+ if (data->is_pipe) {
+ /* Just to display approx. size */
+ data->file.size = rec->bytes_written;
return;
+ }
rec->session->header.data_size += rec->bytes_written;
data->file.size = lseek(perf_data__fd(data), 0, SEEK_CUR);
--
2.43.0.275.g3460e3d667-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf record: Display data size on pipe mode
2024-01-12 23:13 [PATCH] perf record: Display data size on pipe mode Namhyung Kim
@ 2024-02-07 3:43 ` Namhyung Kim
2024-02-07 4:13 ` Ian Rogers
2024-02-07 21:48 ` Namhyung Kim
2 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2024-02-07 3:43 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Jiri Olsa
Cc: Ian Rogers, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
Ping!
On Fri, Jan 12, 2024 at 3:13 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> Currently pipe mode doesn't set the file size and it results in a
> misleading message of 0 data size at the end. Although it might miss
> some accounting for pipe header or more, just displaying the data size
> would reduce the possible confusion.
>
> Before:
> $ perf record -o- perf test -w noploop | perf report -i- -q --percent-limit=1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.000 MB - ] <====== (here)
> 99.58% perf perf [.] noploop
>
> After:
> $ perf record -o- perf test -w noploop | perf report -i- -q --percent-limit=1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.229 MB - ]
> 99.46% perf perf [.] noploop
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/builtin-record.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 91e6828c38cc..21ebcb04f1d8 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -1773,8 +1773,11 @@ record__finish_output(struct record *rec)
> struct perf_data *data = &rec->data;
> int fd = perf_data__fd(data);
>
> - if (data->is_pipe)
> + if (data->is_pipe) {
> + /* Just to display approx. size */
> + data->file.size = rec->bytes_written;
> return;
> + }
>
> rec->session->header.data_size += rec->bytes_written;
> data->file.size = lseek(perf_data__fd(data), 0, SEEK_CUR);
> --
> 2.43.0.275.g3460e3d667-goog
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf record: Display data size on pipe mode
2024-01-12 23:13 [PATCH] perf record: Display data size on pipe mode Namhyung Kim
2024-02-07 3:43 ` Namhyung Kim
@ 2024-02-07 4:13 ` Ian Rogers
2024-02-07 21:48 ` Namhyung Kim
2 siblings, 0 replies; 4+ messages in thread
From: Ian Rogers @ 2024-02-07 4:13 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Adrian Hunter,
Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users
On Fri, Jan 12, 2024 at 3:13 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> Currently pipe mode doesn't set the file size and it results in a
> misleading message of 0 data size at the end. Although it might miss
> some accounting for pipe header or more, just displaying the data size
> would reduce the possible confusion.
>
> Before:
> $ perf record -o- perf test -w noploop | perf report -i- -q --percent-limit=1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.000 MB - ] <====== (here)
> 99.58% perf perf [.] noploop
>
> After:
> $ perf record -o- perf test -w noploop | perf report -i- -q --percent-limit=1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.229 MB - ]
> 99.46% perf perf [.] noploop
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Thanks,
Ian
> ---
> tools/perf/builtin-record.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 91e6828c38cc..21ebcb04f1d8 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -1773,8 +1773,11 @@ record__finish_output(struct record *rec)
> struct perf_data *data = &rec->data;
> int fd = perf_data__fd(data);
>
> - if (data->is_pipe)
> + if (data->is_pipe) {
> + /* Just to display approx. size */
> + data->file.size = rec->bytes_written;
> return;
> + }
>
> rec->session->header.data_size += rec->bytes_written;
> data->file.size = lseek(perf_data__fd(data), 0, SEEK_CUR);
> --
> 2.43.0.275.g3460e3d667-goog
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf record: Display data size on pipe mode
2024-01-12 23:13 [PATCH] perf record: Display data size on pipe mode Namhyung Kim
2024-02-07 3:43 ` Namhyung Kim
2024-02-07 4:13 ` Ian Rogers
@ 2024-02-07 21:48 ` Namhyung Kim
2 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2024-02-07 21:48 UTC (permalink / raw)
To: Namhyung Kim, Arnaldo Carvalho de Melo, Jiri Olsa
Cc: Peter Zijlstra, linux-perf-users, Adrian Hunter, Ian Rogers,
Ingo Molnar, LKML
On Fri, 12 Jan 2024 15:13:40 -0800, Namhyung Kim wrote:
> Currently pipe mode doesn't set the file size and it results in a
> misleading message of 0 data size at the end. Although it might miss
> some accounting for pipe header or more, just displaying the data size
> would reduce the possible confusion.
>
> Before:
> $ perf record -o- perf test -w noploop | perf report -i- -q --percent-limit=1
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.000 MB - ] <====== (here)
> 99.58% perf perf [.] noploop
>
> [...]
Applied to perf-tools-next, thanks!
Best regards,
--
Namhyung Kim <namhyung@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-07 21:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-12 23:13 [PATCH] perf record: Display data size on pipe mode Namhyung Kim
2024-02-07 3:43 ` Namhyung Kim
2024-02-07 4:13 ` Ian Rogers
2024-02-07 21:48 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®