Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2996608ybg; Sat, 6 Jun 2020 07:44:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwou0MeYMPrLR3mbLbxD8TWmrDvsGcLfUGvdnhwe/sv4NaTpgX/kgv8xFenkYgRJb0LAjn2 X-Received: by 2002:a50:9e21:: with SMTP id z30mr13666392ede.347.1591454649813; Sat, 06 Jun 2020 07:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591454649; cv=none; d=google.com; s=arc-20160816; b=auuKbBWJAj9Z1kFooR4M1xrsz2PiQvmnBybBRao3rvQ/Q3RT5/8nwxjmXJ614x6GCH cTGH9pWPOFtStbtwUbMx7Wf2/oQusL3IrElRopLfjBqvz294nMC/f21yNelmHgHy8CnK O1u0afFkxSZOfXXP4owJxQK14yB/KNTuaGh5p0Wz5c8enmAFzFnD5nWsplVOgTNcNRT0 IlfKvCKKJGDxS4wjYPyTXmHFg69V1TEVIu8vYhJ6x5WXPEW/IkJkkU7hEuo64fzp3spL Qx3zWgDE8XkM6DSgDqH34aY1OAQVC0h/ZeQ2i8tpAlLrdfDInn1TmcC9ZBrIgStl2C1N nM3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=dYkV/jB2F/znlUoptYnRvY3ATn24ojNzwogxoU5kZFs=; b=NqIH/Mmt5wb5FKuh2AbDXSdnFuaJDjUBgXIgyzKUOngTVZm5zjUFHHRD1RZEBxeDU2 Qf9ik2cRuh/tETk3DTKEf0FKa9S0OjY/d2sjr1CWcTpZSKW/NHS/xRwx9/K3uK2qaz4L T0A4Dd9XN3HWwlmgXqZWQLRYCsbL3wWAqYLyW/qKIeGEahOOgUMTQHeBUMTlBvb357XQ VleNuWD0+D8sGDN/Set/BBzaJIxMnBpJ9HLFsmBkWbqm8BUDWEwqeaZT8hTdGWnFEkd+ 0jd70Y4TXqkUZ8b6pvFHn/Y0emO51xyfa3fKtu3lSdCKPtxE5KsNf++/3pJdJH8iqwWs jHpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oKtjjgSQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id vr3si5371087ejb.520.2020.06.06.07.43.47; Sat, 06 Jun 2020 07:44:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oKtjjgSQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728770AbgFFOkl (ORCPT + 99 others); Sat, 6 Jun 2020 10:40:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728633AbgFFOkk (ORCPT ); Sat, 6 Jun 2020 10:40:40 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83238C03E96A for ; Sat, 6 Jun 2020 07:40:40 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id d66so6379894pfd.6 for ; Sat, 06 Jun 2020 07:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dYkV/jB2F/znlUoptYnRvY3ATn24ojNzwogxoU5kZFs=; b=oKtjjgSQzWbp4VcoqPjQwnX9jqqPJYRPLFhLJ6JiTLwJhTFPaCVomGGg8xwIM/8swE NJnqqu/340Iyuqtf3htcihMCaZY9KvF6HeH/4+oGgoHNTJAvmbrp1PgxXJIL4xJIYRR+ 0scQwWRlpaGgyO8xFg81k+D9hPKNDiLUXSv/Dr51qzCMT7tPJi4DMJ+yeE4QWEQ6/pIH PgPGl1YZAgfs3ehQoiGCoRlYG0aOItgdgJYVTD+RTy+bVhcwD1btctlnd/EKryLwXbLA ZzTJDJn9v1a561y2Rhqno6lRp2oReaARUl8rCnpH1e3ZQcUWThN/eKFEBc6RF/2UKahQ eJ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dYkV/jB2F/znlUoptYnRvY3ATn24ojNzwogxoU5kZFs=; b=ZPFt791Vfj0HpsGiAmyOetUpD3nrdgNORh8DGLkOkIt8eB1o87rox18SkWOflUwbCT ibKAY8WQfbwfI7x3vg8NhcP0HEa4VdSlot7JP/01QS8HLdObKgmksR/R/EavVm5IgS/J 6bimJ5Q61czEwrf4Qz7XP9lBqRSP2RckUf6rRcX/FmQB0VQMZ+A1dkHkh9EriXg2787h 4ZlLrD7Ly6ovQUInJ20Nd9w28HdgzIsnMnxuRVy4aLqBvF0ooimkKQA1tyRyul0WHpFq NCn6XSlzNDqTYvoDWi6xPnWj520rSC4PdqjebT8JsLDz+xyFk9fSxwxuBdd+vuJ1uYSL Qnkw== X-Gm-Message-State: AOAM5335P3v1lwvke9SsXH77FqRsAc3glflKjphr6L13nsm0BLwTWcf3 7pwskCaL7Y3Jpang2xmzybz9oWvMUyGArA== X-Received: by 2002:a65:4807:: with SMTP id h7mr7372184pgs.123.1591454440068; Sat, 06 Jun 2020 07:40:40 -0700 (PDT) Received: from mail.google.com ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id l4sm2125671pgo.92.2020.06.06.07.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jun 2020 07:40:39 -0700 (PDT) Date: Sat, 6 Jun 2020 22:40:31 +0800 From: Changbin Du To: Arnaldo Carvalho de Melo Cc: Changbin Du , Jiri Olsa , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Steven Rostedt , linux-kernel@vger.kernel.org Subject: Re: [PATCH 14/19] perf ftrace: add option -P/--no-pager to disable pager Message-ID: <20200606144031.vbmo7pjuhd2ltuem@mail.google.com> References: <20200510150628.16610-1-changbin.du@gmail.com> <20200510150628.16610-15-changbin.du@gmail.com> <20200520210914.GC32678@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200520210914.GC32678@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 20, 2020 at 06:09:14PM -0300, Arnaldo Carvalho de Melo wrote: > Em Sun, May 10, 2020 at 11:06:23PM +0800, Changbin Du escreveu: > > Sometimes we want perf displays trace immediately. So this adds an option > > '-P/--no-pager' to disable pager if needed. > > > Try: > > perf record sleep 5 > perf script > > Then: > > perf --no-pager script > > I.e. its there already. > > - Arnaldo > Yes, just tried this and it works: perf --no-pager ftrace So, the problem is that this option is not documented. > > > > Signed-off-by: Changbin Du > > --- > > tools/perf/builtin-ftrace.c | 17 ++++++++++++++--- > > 1 file changed, 14 insertions(+), 3 deletions(-) > > > > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c > > index a93fbdac6aa4..64c22f367ba2 100644 > > --- a/tools/perf/builtin-ftrace.c > > +++ b/tools/perf/builtin-ftrace.c > > @@ -48,6 +48,7 @@ struct perf_ftrace { > > unsigned tracing_thresh; > > bool trace_children; > > unsigned buffer_size_kb; > > + bool no_pager; > > }; > > > > struct filter_entry { > > @@ -56,6 +57,7 @@ struct filter_entry { > > }; > > > > static volatile int workload_exec_errno; > > +static bool interrupted; > > static bool done; > > > > static void sig_handler(int sig __maybe_unused) > > @@ -63,6 +65,12 @@ static void sig_handler(int sig __maybe_unused) > > done = true; > > } > > > > +static void sig_handler_int(int sig __maybe_unused) > > +{ > > + sig_handler(sig); > > + interrupted = 1; > > +} > > + > > /* > > * perf_evlist__prepare_workload will send a SIGUSR1 if the fork fails, since > > * we asked by setting its exec_error to the function below, > > @@ -492,7 +500,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > > return -1; > > } > > > > - signal(SIGINT, sig_handler); > > + signal(SIGINT, sig_handler_int); > > signal(SIGUSR1, sig_handler); > > signal(SIGCHLD, sig_handler); > > signal(SIGPIPE, sig_handler); > > @@ -585,7 +593,8 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > > goto out_reset; > > } > > > > - setup_pager(); > > + if (!ftrace->no_pager) > > + setup_pager(); > > > > trace_file = get_tracing_file("trace_pipe"); > > if (!trace_file) { > > @@ -636,7 +645,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) > > } > > > > /* read remaining buffer contents */ > > - while (true) { > > + while (true && !interrupted) { > > int n = read(trace_fd, buf, sizeof(buf)); > > if (n <= 0) > > break; > > @@ -731,6 +740,8 @@ int cmd_ftrace(int argc, const char **argv) > > "Trace children processes"), > > OPT_UINTEGER('b', "buffer-size", &ftrace.buffer_size_kb, > > "size of per cpu buffer in kb"), > > + OPT_BOOLEAN('P', "no-pager", &ftrace.no_pager, > > + "Do not use pager"), > > OPT_END() > > }; > > > > -- > > 2.25.1 > > > > -- > > - Arnaldo -- Cheers, Changbin Du