Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2314461ima; Mon, 22 Oct 2018 07:49:57 -0700 (PDT) X-Google-Smtp-Source: ACcGV62yGy/gwb4D0leQlunHVu03OOusARXvGoG/zMpY8BWPcmYBJNjoR4CUAbs2xaDxOlX2IcuE X-Received: by 2002:a63:164d:: with SMTP id 13-v6mr43169112pgw.103.1540219797773; Mon, 22 Oct 2018 07:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540219797; cv=none; d=google.com; s=arc-20160816; b=t/Z2oAr9iynVOPrnj8wznKUr274AdVkiND+04Un/zxCHWVF6EhoL2ywzWBEQkA5DFA mI0oUPa2Rm0oYw+XpOHbOFZUh0Oa9wMzv457LQsu4ROVW9t5eXqZZXuOMDjV+kht/OX+ EhAEYHKL65tQAO/4aep/aEt/YdDJIFU9shAv52BgOvZ6GtbM12eCdTqg9YvKh3rY47ka zH2pAybau0Y/YRxMXT99V198UBFbdJDy4TFiVyDZW7wYeTTOhtH0JFMjtpcbRN69pFa2 cW/Hn2xJ3a6Afml5ZjvK8KQqWpgZbGwGTU+96DkqwipZPvBneWVJ81LKBLx3KpomuCMF K+4w== 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; bh=YKr7WhE9KCLPplebG/PZN21RJpyej8MbX5t/eToioX8=; b=KYgJupLJb7UKcC2szGsOH+AvSnbIOp2SYVLhs9wvzQeC6nBLMGJ/rcB0onaH2Hayvk TwcsOtBvlDpj8pCilQWIzmJQYC+LdkXqNjp+DODx86whKcmvojq+Ezypp/3cspIXun2Y xiY0ouFkAxbRLepY9ceWIiq4OaaWcQFa05WmbvDtOZ+B43bpxJr6vC2B0Sfx4vtACEqz RIZ/WDbl0WepM4ELxC0IyGcBP/wq/6YdY2vM1F2wENVmZeJRK3vOHPck+rkPXUKi4R+2 HceK/TW/ZbWUpnGB6c+poWsg/xEyix/IZSoFnwZQebRBLPIfGXNVVFNEMeQ1qJ+U/RSS l/Eg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6-v6si35342949pge.215.2018.10.22.07.49.21; Mon, 22 Oct 2018 07:49:57 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728200AbeJVWNO (ORCPT + 99 others); Mon, 22 Oct 2018 18:13:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50362 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727587AbeJVWNN (ORCPT ); Mon, 22 Oct 2018 18:13:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2DC95F74A; Mon, 22 Oct 2018 13:54:32 +0000 (UTC) Received: from krava (unknown [10.43.17.150]) by smtp.corp.redhat.com (Postfix) with SMTP id B62BE608F3; Mon, 22 Oct 2018 13:54:31 +0000 (UTC) Date: Mon, 22 Oct 2018 15:54:30 +0200 From: Jiri Olsa To: Milian Wolff Cc: acme@kernel.org, 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: <20181022135430.GA2945@krava> References: <20181021191424.16183-1-milian.wolff@kdab.com> <4444017.LnbBPIbh24@agathebauer> <20181022101618.GH2452@krava> <1755624.MxyOU8z0WO@agathebauer> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1755624.MxyOU8z0WO@agathebauer> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 22 Oct 2018 13:54:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, jirka