Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2506782ima; Mon, 22 Oct 2018 10:53:10 -0700 (PDT) X-Google-Smtp-Source: AJdET5e/ecBSMlKyu2D1PrLBK0Bm8ifjB0g0ezIfHQbuNthhEdR+TUsV3asZRdbqGHQO1Dckrn4Z X-Received: by 2002:a17:902:34a:: with SMTP id 68-v6mr5286724pld.184.1540230790522; Mon, 22 Oct 2018 10:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540230790; cv=none; d=google.com; s=arc-20160816; b=PPUFsF9B5rnXqMd37XjwGgC/J9ijvKJQwIgflBgkVC0p2i9iDMF/q3alnCO+NVZLeo 82EzNrBAjeI+vBdoIZK/zp05KK5d4+bZbr7mYTBiRWt1Q6Mn448mqIh8UIV692zqHQqw 3G4732BNQZPzIfKf+WrCNeHukfGVUYbxdtmYqoJ+OjIV6b25pk82BfWLK96uem/gMGKT EMy1cxXuKXYIYUtXzQ3H1BbXsohFc4wpedir9dsEZSW8U5n308Ifky0b87oaKoYUHyzp UOdmT0Z4Rb32//AhCgFSGLLOUGIUtP9LDhqbO/b7ZxROiwX/OBRA9Atox5PY/IFFAkBK zASw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=O5+yiiXAawX9Ug+6lddKMOI9CPeqLRRqKnXaRHo/Qm4=; b=oTcAbFG1D8nw7TGv6L3RLEoD1rWSA10NoZAaF1vcXoF8uJRBl5gGw2b+YEEbTxmcmM n3TweE7Aift+jj+EJ5c9GY+RlHnJFaTvaNpobisvram2tnhJiXeKkKtPzAmJUIxGPuhJ rJ+zvM+RpxqsHfHmX8Ye7Fb1bX6zunctLMOC/DgO9DXYSib0DQN1GNz8OO45Bi8CwDpz JhY0OXL5JU+GDSC5IyadMZyFChlNbAmrrRjHirc5tlnYMGI1vSQrM2EfZIAtUFUg9PD6 roJYQycBMDir049y2ZDa79fib4Aou2WZk5FvAUPRh90/uRZBunbaPrcRswSCDScGlRMe oQvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CquypuoY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x85-v6si35259840pfk.54.2018.10.22.10.52.55; Mon, 22 Oct 2018 10:53:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CquypuoY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728721AbeJWBpX (ORCPT + 99 others); Mon, 22 Oct 2018 21:45:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:58440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728046AbeJWBpX (ORCPT ); Mon, 22 Oct 2018 21:45:23 -0400 Received: from jouet.infradead.org (unknown [190.15.121.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B0E99205F4; Mon, 22 Oct 2018 17:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540229159; bh=00TLTxYsiS6SF2sposIFtTi7S4BybskN4ob96wGHzHI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CquypuoYtoLWgyTw6PpR0XB3zgDuiqg+3x/lxBkCf6D8rVwMgUN5WVRs2vMyWZXSd XCw6UIzw5uAg3EjP7so90VER5eQ5i5PqMPhiPYDxR+2ouIUvF3O8WDBDTyMbx+E0aT Mj9GjbWlW3mZ06PjvpimRu0SMb73Qka9S9bkdE+w= Received: by jouet.infradead.org (Postfix, from userid 1000) id BA828142C5E; Mon, 22 Oct 2018 14:25:56 -0300 (-03) Date: Mon, 22 Oct 2018 14:25:56 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Milian Wolff , 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 Message-ID: <20181022172556.GM3849@kernel.org> References: <20181021191424.16183-1-milian.wolff@kdab.com> <4444017.LnbBPIbh24@agathebauer> <20181022101618.GH2452@krava> <1755624.MxyOU8z0WO@agathebauer> <20181022135430.GA2945@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181022135430.GA2945@krava> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Thanks, applied. - Arnaldo