Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6150612rwb; Mon, 14 Nov 2022 15:19:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Bfi/31pHW//GojqRe3XL9aU50zcrufNzYX2OoJ95F70/50HlqTtMfI7JIS+FGPzTISBKu X-Received: by 2002:a17:902:f70c:b0:188:b0db:cd5d with SMTP id h12-20020a170902f70c00b00188b0dbcd5dmr1355832plo.104.1668467970662; Mon, 14 Nov 2022 15:19:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668467970; cv=none; d=google.com; s=arc-20160816; b=FDhLeOvx39RCKcCLLX1qPJp/ddyFKnligMX33Gh/tV7GET9Z8/BXmyVeDzyfbpf1Xn 0hsrOYZVfwGk/R+LwvqalCIvGY7YacKVYM16BZqaOze5FiPYhbQWdp9Ls3+GuzpJ1wym UtXoUFjwd45Tg4MeC9xXbL3PlpZ0qrjCLqdnv47Qg/RFhDB6D3heJl4DnjwSJ7rhyUo6 wMi/ZsqXyUDwtahH1Z73TEb/grlGMJK0dmegNjPnEWq6pKSS8+wnfINyV0Ej8gRo6Rz8 JY3NKal3/Nmt0QUEFNzg/KvBFEe5AWGsYmfETjiXAB2LyG9pnenyPGWvGaNwHE/vJHQI mypg== 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=rt0OZoaxk4oNSiXVua0yf4Wn8zR1kll8hc9QqXyH+pA=; b=JGR3U9xoXTe3E10oi+6If85QnH4uX/12HlX2zEYAN9C9pyueX08B/prkQyo78Sq8JC bmXGjli97kVcpO9I1W25M4tT7WmPyfo3FIqzH6IjBk769fQ6k8WJr3uptyw6jsqgP6hj vMIkkUFTTWgSyvsY1F1jme4P9VGTfABfELYcgwQeT7PmTmkwnfttW8jWHqwwyM8MbZCx 7XjjyAqpF5Hzhcwb7AvUCWG8OQCIhbWbQiC6tWZv/kSpdMajmOmglNJl/pr8HN5I9dxi vdx+vpXpLW9PXmKAbs1Y8G+Cb1OB0lNqaNLLxVQqF6QqsEdOG4CnXlxt+axRyAXdRWYm 9kPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="jcCl/Fyx"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g27-20020a63111b000000b00439e6a50555si10793151pgl.87.2022.11.14.15.19.19; Mon, 14 Nov 2022 15:19:30 -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="jcCl/Fyx"; 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 S237853AbiKNXC6 (ORCPT + 88 others); Mon, 14 Nov 2022 18:02:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237867AbiKNXCc (ORCPT ); Mon, 14 Nov 2022 18:02:32 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C0EF1B7B5; Mon, 14 Nov 2022 15:02:32 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id io19so11492230plb.8; Mon, 14 Nov 2022 15:02:32 -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=rt0OZoaxk4oNSiXVua0yf4Wn8zR1kll8hc9QqXyH+pA=; b=jcCl/FyxwF3w7YMSk3Qw/Vq3k7ny8Me1VSIXUCAQy0kPHz04yRm68l9gT56RqRB7s3 gK8a7gbS0ZDoygeaAfUqQopGM/82KP1s6SScgdXGARymg+iDxMU5JtpKZOtx5IzkxFjK WfWTQnf88m4QF2Y0pRJQKDWSwwdKvML/JgXrXTz9EikSAav+lDT0ZurpRK37CCWZLzSd lG4GPJCdbdfn+3P5T+cmKS2npifOuuag0uwI4HQHxjjY8iTd0I1MeFcrmWtqDi5ipaNP gPtvdjPcx0L4/5hb6cegUBmRe/6thNB3On6+9C3T84Exn79BE4YEcFRTPyy45tRF6A8B dOHA== 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=rt0OZoaxk4oNSiXVua0yf4Wn8zR1kll8hc9QqXyH+pA=; b=AuQsUcCaWh88OGf31fpw/33a2j2dkGJcC+IyXqBnFMzGGc15Q32X3t4V084fpcCMSe ym6bazRh0CeRpyOptCL64jTsNOTcoW4MCL7u0YrXwb+SI9BLwmjAamvNVypu/kXxdCj3 UluJ4CLnYnjApYJZ5tO5nPF4k/GmldN2v/RWgkra47DT6/mUEP5mnETdowqyG70Jh8Ea X5hkHUy88VHD4u0Pm200DsR9JTZB7T6S0lq7/iVZE7gtRJajvs6AgL2Fw7W984SPIhrU M5qwkKu93ybk3GI4nIkIpkQvCwib8FN4IzAqCzgmJLRy3ULi8uIPbwJ43eYJ09sKZGM+ qTIw== X-Gm-Message-State: ANoB5pkfozXy2LZ/xdcWy/v/AUs1Y4aeeAj1e9n35BJyzRaTGHK1DgEE GyG7jdC5XTqqSNTMUk5kUQs= X-Received: by 2002:a17:902:be13:b0:186:748f:e8c5 with SMTP id r19-20020a170902be1300b00186748fe8c5mr1358372pls.73.1668466951601; Mon, 14 Nov 2022 15:02:31 -0800 (PST) Received: from balhae.hsd1.ca.comcast.net ([2601:647:6780:a80:cf9f:e038:c19b:797e]) by smtp.gmail.com with ESMTPSA id 132-20020a62148a000000b0056c814a501dsm7534724pfu.10.2022.11.14.15.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 15:02:31 -0800 (PST) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Kan Liang , Zhengjun Xing , James Clark , Athira Jajeev Subject: [PATCH 01/19] perf stat: Clear screen only if output file is a tty Date: Mon, 14 Nov 2022 15:02:09 -0800 Message-Id: <20221114230227.1255976-2-namhyung@kernel.org> X-Mailer: git-send-email 2.38.1.493.g58b659f92b-goog In-Reply-To: <20221114230227.1255976-1-namhyung@kernel.org> References: <20221114230227.1255976-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 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: X-Mailing-List: linux-kernel@vger.kernel.org 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. Make it fail when it's enabled with the output options. $ perf stat -I 1 --interval-clear -o myfile true --interval-clear does not work with output Usage: perf stat [] [] -o, --output output file name --log-fd log output to fd, instead of stderr --interval-clear clear screen in between new interval Signed-off-by: Namhyung Kim --- tools/perf/builtin-stat.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index d5e1670bca20..1d79801f4e84 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -2403,6 +2403,14 @@ int cmd_stat(int argc, const char **argv) } } + if (stat_config.interval_clear && !isatty(fileno(output))) { + fprintf(stderr, "--interval-clear does not work with output\n"); + parse_options_usage(stat_usage, stat_options, "o", 1); + parse_options_usage(NULL, stat_options, "log-fd", 0); + parse_options_usage(NULL, stat_options, "interval-clear", 0); + return -1; + } + stat_config.output = output; /* -- 2.38.1.493.g58b659f92b-goog