Message ID | 20221107213314.3239159-4-namhyung@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2309609wru; Mon, 7 Nov 2022 13:38:11 -0800 (PST) X-Google-Smtp-Source: AMsMyM6x9PYo2DXtPyJ15gBBwLcG/DYCXT3VYmtm1ybQ508cdUSy1rS4Dr0ziL9rynMXoj4c3HVg X-Received: by 2002:a17:90a:7e10:b0:213:9e81:87e2 with SMTP id i16-20020a17090a7e1000b002139e8187e2mr56203738pjl.1.1667857091423; Mon, 07 Nov 2022 13:38:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667857091; cv=none; d=google.com; s=arc-20160816; b=MKjLvQVoVC0reABME46J41jh4fRQL+xGN4DH249gURktkiBy0vQArfqMNk+ooF0i1g YbjDruVWbD210Zkk5DZ2YNmYFI+FgKo7Qqw9aTNqueTjEnJXERRqs8ZIY7a6HALjDJhb LvqsBpyLpgCFh3UTpZ4tiKc4lvSNVd8IlKD/BbodqUsiQ0GpmgFXBk6dM97f6emk+HHZ olGdpC4444vkrAcYrYg8VX3w1kO0OfNbJ5sHizsQkrD6U9RTeeGHW4iag/gV7zPAJoO6 Ly04d4q7tW0YyEOiH2BARnKBHawTOX+NcFe3Eqy8chhHT1K7EQL2NjbgC+9MI3SbXBmP KTBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=7OYL7vpqm8L3ADcCJc6hKNFYnwJB/S0aPLCXr3zst78=; b=VclXKmKGZ6OTCiT5WotMKZ00R/63tNkg5TccpNc7MQKYTl7qeEzqg0QGFa7my41sgY knAKVuuHll9depsSKKIASA/QuZNCa/6L6id9TvvrzlRasFcOSjuxtOUbtIglN1XAi+/B 6+8NHHitNh40AXv86bcoAK6VKk0QSUxd7gUwHDaN4CsjUoyIxzGIBlpCH63npX142lNp kw39n0gLEOLo0sKsybHQe9+6+JRr4aFXd/PoxICxA8VkVgD4EsMTLtrZRd3DUdyBtz0g CJfqgpTpj1YUNGIcVj7biZ+awv92d7kZHtJ4JnAF8JJa9T1o0QlK/8z1SYkm4pRQqeeN 1zNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="CESh0/Zb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a170902d2cc00b001868277386dsi13782772plc.192.2022.11.07.13.37.55; Mon, 07 Nov 2022 13:38:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="CESh0/Zb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233481AbiKGVdg (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 16:33:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233405AbiKGVdY (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 16:33:24 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FD79328; Mon, 7 Nov 2022 13:33:23 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id k22so11912408pfd.3; Mon, 07 Nov 2022 13:33:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=7OYL7vpqm8L3ADcCJc6hKNFYnwJB/S0aPLCXr3zst78=; b=CESh0/ZbpAqv78rvTm8npz/mdldte6JqrpQpXmkhJ2wRVcw0OaAFcL7610kd1GdKl8 AZCMrJ9+Fs+7tIV9NG0S4KQq/FViPJ+GxPNZg5ErU7py8WNJmC716PJCcJ3NKBDpkVC0 xTzO6S6hKRmmYXSM5FtGZYrsRN6DufyRAY9noU6V7TwryqQRIz7PAiORUIAZwdCOGtRG TQZE32AFfYDUYjXo5n+KUygsPtM/N/UdLqjpylqsmJqrf7h0JP3WScHuthqjjoywNV5i GG2fqxjkgycjEBQsNbmHSCwgfzuhZYojwxUFKW94EHDJAjtXmLofBafb/AdjMS5CfY+m /D/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7OYL7vpqm8L3ADcCJc6hKNFYnwJB/S0aPLCXr3zst78=; b=Gsk8NJHsaKlyseXSHVyi43sTCcqumycHxBkRHw55Dj7H7zF0hr1dXbzXx2xFzG+dwA aR9BwCA1noYhTuiTqIBqtlkC6HqUDyFSbdemfNVL3wCNztLM27imDn8vwJVbaXsCAVfj Ul8KlujcZkT3hb330FYjWm1jqcUsrFjRanVL70M7QWMTiVyTFtwQlQOdF89GM8RBlOOc Cm5BCPMRCH7MEUYvWFIulfn/5MJaaRM5eGifBz+VJypjhXpj9tFsMeCEaVNiSKZhAJC+ yHKGnsijxjN/mEht8tKyKQL5qLXCz4lo10GxFDk6lp4+rmbLlgesAwcyxueEidAmCWXa vUzw== X-Gm-Message-State: ACrzQf2pj+rdmyjVSS5yGMXW6hKeUqWXliPXxlozkPb/bTnsybCkTAn5 PlUTxi332PrXWA5EEI6u/lU= X-Received: by 2002:a65:6950:0:b0:439:51cd:8b8b with SMTP id w16-20020a656950000000b0043951cd8b8bmr45185677pgq.230.1667856802573; Mon, 07 Nov 2022 13:33:22 -0800 (PST) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:5850:5958:9c77:f623]) by smtp.gmail.com with ESMTPSA id a1-20020a1709027e4100b0017f5ba1fffasm5366413pln.297.2022.11.07.13.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 13:33:22 -0800 (PST) Sender: Namhyung Kim <namhyung@gmail.com> From: Namhyung Kim <namhyung@kernel.org> To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org> Cc: Ingo Molnar <mingo@kernel.org>, Peter Zijlstra <peterz@infradead.org>, LKML <linux-kernel@vger.kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, linux-perf-users@vger.kernel.org, Kan Liang <kan.liang@linux.intel.com>, Zhengjun Xing <zhengjun.xing@linux.intel.com>, James Clark <james.clark@arm.com> Subject: [PATCH 3/9] perf stat: Clear screen only if output file is a tty Date: Mon, 7 Nov 2022 13:33:08 -0800 Message-Id: <20221107213314.3239159-4-namhyung@kernel.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221107213314.3239159-1-namhyung@kernel.org> References: <20221107213314.3239159-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748874917251559317?= X-GMAIL-MSGID: =?utf-8?q?1748874917251559317?= |
Series |
perf stat: Cleanup perf stat output display (v1)
|
|
Commit Message
Namhyung Kim
Nov. 7, 2022, 9:33 p.m. UTC
The --interval-clear option makes perf stat to clear the terminal at
each interval. But it doesn't need to clear the screen when it saves
to a file.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/stat-display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Nov 7, 2022 at 1:33 PM Namhyung Kim <namhyung@kernel.org> wrote: > > The --interval-clear option makes perf stat to clear the terminal at > each interval. But it doesn't need to clear the screen when it saves > to a file. Would it be more intuitive to warn if interval-clear is specified with a file? Thanks, Ian > Signed-off-by: Namhyung Kim <namhyung@kernel.org> > --- > tools/perf/util/stat-display.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c > index 17d656566cd9..d4936a502560 100644 > --- a/tools/perf/util/stat-display.c > +++ b/tools/perf/util/stat-display.c > @@ -892,7 +892,7 @@ static void print_interval(struct perf_stat_config *config, > FILE *output = config->output; > static int num_print_interval; > > - if (config->interval_clear) > + if (config->interval_clear && isatty(fileno(output))) > puts(CONSOLE_CLEAR); > > if (!config->iostat_run && !config->json_output) > -- > 2.38.1.431.g37b22c650d-goog >
Hi Ian, On Tue, Nov 8, 2022 at 3:16 PM Ian Rogers <irogers@google.com> wrote: > > On Mon, Nov 7, 2022 at 1:33 PM Namhyung Kim <namhyung@kernel.org> wrote: > > > > The --interval-clear option makes perf stat to clear the terminal at > > each interval. But it doesn't need to clear the screen when it saves > > to a file. > > Would it be more intuitive to warn if interval-clear is specified with a file? Makes sense, will change. Thanks, Namhyung
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 17d656566cd9..d4936a502560 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -892,7 +892,7 @@ static void print_interval(struct perf_stat_config *config, FILE *output = config->output; static int num_print_interval; - if (config->interval_clear) + if (config->interval_clear && isatty(fileno(output))) puts(CONSOLE_CLEAR); if (!config->iostat_run && !config->json_output)