[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWCQqzPMV=3+o5W6fWx2vy2h0gMicU+ysnTqCy6iiLbaA@mail.gmail.com>
Date: Tue, 6 Feb 2024 20:13:32 -0800
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH] perf record: Display data size on pipe mode
On Fri, Jan 12, 2024 at 3:13 PM Namhyung Kim <namhyung@...nel.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@...nel.org>
Reviewed-by: Ian Rogers <irogers@...gle.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
>
Powered by blists - more mailing lists