linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Milian Wolff <milian.wolff@kdab.com>,
	jolsa@kernel.org, Linux-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 2/2] perf script: flush output stream after events in verbose mode
Date: Mon, 22 Oct 2018 14:25:56 -0300	[thread overview]
Message-ID: <20181022172556.GM3849@kernel.org> (raw)
In-Reply-To: <20181022135430.GA2945@krava>

Em Mon, Oct 22, 2018 at 03:54:30PM +0200, Jiri Olsa escreveu:
> On Mon, Oct 22, 2018 at 12:38:57PM +0200, Milian Wolff wrote:
> 
> SNIP
> 
> > > > > > diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> > > > > > index bd468b90801b..ca09b7d2adb7 100644
> > > > > > --- a/tools/perf/builtin-script.c
> > > > > > +++ b/tools/perf/builtin-script.c
> > > > > > @@ -1737,6 +1737,9 @@ static void process_event(struct perf_script
> > > > > > *script,
> > > > > > 
> > > > > >  	if (PRINT_FIELD(METRIC))
> > > > > >  	
> > > > > >  		perf_sample__fprint_metric(script, thread, evsel, 
> > sample, fp);
> > > > > > 
> > > > > > +
> > > > > > +	if (verbose)
> > > > > > +		fflush(fp);
> > > > > 
> > > > > should we call fflush(NULL) to dump all the streams?
> > > > > 
> > > > > the verbose goes to stderr and fp seems to be stdout byt default
> > > > 
> > > > stderr isn't buffered, so we don't need to flush it. So personally, I
> > > > don't
> > > > see a need to dump all streams - fp should be enough? Can you maybe
> > > > explain
> > > > where it would be required to flush more buffers?
> > > 
> > > hum, did not know stderr wasn't buffer
> > >
> > > I think there's perf script feature to store the events data to
> > > separate files per each event.. but I guess we don't need to
> > > flush them.. we just need to have stdout and stderr in sync IIUC
> > 
> > Exactly, and that's achieved with this patch form what I see :) Or should we 
> > maybe instead call 
> > 
> > setbuf(fp, NULL);
> > 
> > in verbose mode?
> 
> I think your solution is ok
> 
> Acked-by: Jiri Olsa <jolsa@redhat.com>

Thanks, applied.

- Arnaldo

  reply	other threads:[~2018-10-22 17:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-21 19:14 [PATCH 1/2] perf script: allow extended console debug output Milian Wolff
2018-10-21 19:14 ` [PATCH 2/2] perf script: flush output stream after events in verbose mode Milian Wolff
2018-10-22  9:43   ` Jiri Olsa
2018-10-22 10:09     ` Milian Wolff
2018-10-22 10:16       ` Jiri Olsa
2018-10-22 10:38         ` Milian Wolff
2018-10-22 13:54           ` Jiri Olsa
2018-10-22 17:25             ` Arnaldo Carvalho de Melo [this message]
2018-10-22  9:40 ` [PATCH 1/2] perf script: allow extended console debug output Jiri Olsa
2018-10-22 15:09   ` Arnaldo Carvalho de Melo

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=20181022172556.GM3849@kernel.org \
    --to=acme@kernel.org \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=milian.wolff@kdab.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;
as well as URLs for NNTP newsgroup(s).