From: Paul Chaignon <paul@isovalent.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>, bpf <bpf@vger.kernel.org>,
Quentin Monnet <quentin@isovalent.com>
Subject: Re: [PATCH bpf v2] bpftool: Flush tracelog output
Date: Mon, 20 Dec 2021 22:48:15 +0100 [thread overview]
Message-ID: <20211220214815.GA11826@Mem> (raw)
In-Reply-To: <CAEf4BzYxLcZRq685reGkNRBWNpxLWnEt3u_J1pBCb1ptrU0z1A@mail.gmail.com>
On Fri, Dec 17, 2021 at 08:51:01AM -0800, Andrii Nakryiko wrote:
> On Fri, Dec 17, 2021 at 6:11 AM Paul Chaignon <paul@isovalent.com> wrote:
> >
> > The output of bpftool prog tracelog is currently buffered, which is
> > inconvenient when piping the output into other commands. A simple
> > tracelog | grep will typically not display anything. This patch fixes it
> > by flushing the tracelog output after each line from the trace_pipe file.
> >
> > Fixes: 30da46b5dc3a ("tools: bpftool: add a command to dump the trace pipe")
> > Signed-off-by: Quentin Monnet <quentin@isovalent.com>
> > Signed-off-by: Paul Chaignon <paul@isovalent.com>
> > ---
> > Changes in v2:
> > - Resending to fix a format error.
> >
> > tools/bpf/bpftool/tracelog.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/bpf/bpftool/tracelog.c b/tools/bpf/bpftool/tracelog.c
> > index e80a5c79b38f..b310229abb07 100644
> > --- a/tools/bpf/bpftool/tracelog.c
> > +++ b/tools/bpf/bpftool/tracelog.c
> > @@ -158,6 +158,7 @@ int do_tracelog(int argc, char **argv)
> > jsonw_string(json_wtr, buff);
> > else
> > printf("%s", buff);
> > + fflush(stdout);
>
> maybe it's better to
>
> setlinebuf(stdout);
>
> for the entire bpftool instead?
Makes sense. I've sent a v3 at
https://lore.kernel.org/bpf/20211220214528.GA11706@Mem/T/.
>
>
> > }
> >
> > fclose(trace_pipe_fd);
> > --
> > 2.25.1
> >
prev parent reply other threads:[~2021-12-20 21:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 14:11 [PATCH bpf v2] bpftool: Flush tracelog output Paul Chaignon
2021-12-17 16:51 ` Andrii Nakryiko
2021-12-20 21:48 ` Paul Chaignon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211220214815.GA11826@Mem \
--to=paul@isovalent.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=quentin@isovalent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox