From patchwork Mon Nov 7 21:33:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 16736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2309144wru; Mon, 7 Nov 2022 13:37:05 -0800 (PST) X-Google-Smtp-Source: AMsMyM6PsfljI5jHVshWTTHen7jvcMPMuiL9Kw96Uw1WTSJ03g5bN6+iGlVTflM8JHX9zufr/Cx/ X-Received: by 2002:a17:907:7626:b0:7aa:987f:4e8f with SMTP id jy6-20020a170907762600b007aa987f4e8fmr50271169ejc.204.1667857024959; Mon, 07 Nov 2022 13:37:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667857024; cv=none; d=google.com; s=arc-20160816; b=bPuM1S5BXjgMlCBl4BfWux1XQxhao4Wy5sEgsSy1FyPhZtM9dpJcN019gy8MPGf8+k z0jZaMMZJ766rjk59h0zjbxafcxgp4OdN6KGMiz5qXMGKh5wwNzQG3QhTNPFtWn7AvKn /h7sSFjJ0b0QkRa+vrf67jWyKoOHmu2eoaipsiQjmHX7POJwAho4IWxSgROs6R3YPHya fwxf5JJ2YNHKEN3x0BkmuB2smSuzlTcIkFwtMdUWlY9o88tB0M4EUSCXqffP62WyCXh/ YvKIQ7ZNaxRrT0LO4oSiZOqx1Rx2oPvnzmhU07uftClC70CskTeEvRk6BjQN41gZsflK HnDw== 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=F3kWpBC1NLbl49EVyM6kuTlOZ/tQuDbS9uiyiK9Bcd8=; b=LDUlxod7ViWAsoA9ds6vBfdPq8Lu99RouzyIduKFFo8zoSqcYJrvfb36b1xixVqT2S EeiWbjv7SsHwCnNa6ANuqPsFC3CLPsBmbS0TElae7aWNMynh3sdXV00asImTEo2dxksE zs9FD4JD8t/uHJDR1wVyZuENfTh/ewaXWCtNcU2Hb5+Rg7O1Yvv1g44+c8s3YQ4Dw6vp Awz+6cClAiE9//cmpL4VoguYOp3WPTVm8bQBDy6ZIJmcksGG8i/mR9wXxVpWuNTMvmgK KZLFWf5tYbwWrtrjOPi9rA9p/dtRCPZI9g+a1i7jH7rt2RVvETwlTcpp7HhqJbjusqY+ VCYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FcSbzoNL; 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 hv13-20020a17090760cd00b007add164bc81si7915329ejc.222.2022.11.07.13.36.41; Mon, 07 Nov 2022 13:37:04 -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=FcSbzoNL; 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 S233584AbiKGVeF (ORCPT + 99 others); Mon, 7 Nov 2022 16:34:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233514AbiKGVdq (ORCPT ); Mon, 7 Nov 2022 16:33:46 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCD1F2195; Mon, 7 Nov 2022 13:33:29 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id z5-20020a17090a8b8500b00210a3a2364fso182795pjn.0; Mon, 07 Nov 2022 13:33:29 -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=F3kWpBC1NLbl49EVyM6kuTlOZ/tQuDbS9uiyiK9Bcd8=; b=FcSbzoNLCo8OoQLRTy1AojjTte1miTZf2JSnw5QprLwVDsrGsELCcwIEOdIuBoGpuI v5+QS0SkLzYXJtsLG8JJ19RCg1oSgUJNg6OMEKclucZVbPXotCqihsfZWk9GZfFgIqWG 0Tl69ccf++bhhstTYh68opUzCqfz0nKNORwqH72toYynd+9Jvq6gLdU+gMo7f7qyAQuh 5G+CqBcYQ/S6LR6b0mn8ceudSUEWwh0AXmK31d4feFd0YjHjQpivKkBuzRUyNhc4EFiv wCaAwr6Q2pvBvaNONSW5yJSEmo4bYtd8WrOoqJLnYK/xo4Z/eGoOTlgvZa8MJpV7pZu9 HUxA== 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=F3kWpBC1NLbl49EVyM6kuTlOZ/tQuDbS9uiyiK9Bcd8=; b=x4KYb1PdRWFTJFwHweqkRg2bJdPCyxNasrfpt8O8tTyvHeoi6n5JOiPNMnsjfVlLbV G8uiFLTnhPMQlufccdSENX4Z+1kUQeqsg2W96qtfR3UZ/WJ9nApnyTNXU5Qge13mYk6N 2OhkxzedUVuuqiP0Ije5l9SfcWkiO5ylRyz91VYjo2Li0t1InFsCdd2Rsn9meL90t1Kp 3E72IveYcUFRIqPanYGUEpZgNfjaWrkFiWQh2M1DjLkjnT5R7lx0HrWkJDPuel3SDEzB Ykc/KhlZ8uG9IMwcL7ZWtTOSKJ3Owso+1JfPIMPo/85mc4Zeiq8QjWZKygEg3R0LRTo4 rYEQ== X-Gm-Message-State: ACrzQf1/Fwohts8nM9NW4IcMleU+elBHttkM3z9HpsiqbtnPUbFa0eBz eBcPoblCH/eMIGPuExFthQM= X-Received: by 2002:a17:902:e846:b0:187:2127:cbb with SMTP id t6-20020a170902e84600b0018721270cbbmr44249969plg.125.1667856808976; Mon, 07 Nov 2022 13:33:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 13:33:28 -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 Subject: [PATCH 8/9] perf stat: Fix condition in print_interval() Date: Mon, 7 Nov 2022 13:33:13 -0800 Message-Id: <20221107213314.3239159-9-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748874847782184430?= X-GMAIL-MSGID: =?utf-8?q?1748874847782184430?= The num_print_interval and config->interval_clear should be checked together like other places like later in the function. Otherwise, the --interval-clear option could print the headers for the CSV or JSON output unnecessarily. Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/util/stat-display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index aab2576bd40f..a10af26c26ab 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -902,8 +902,8 @@ static void print_interval(struct perf_stat_config *config, sprintf(prefix, "{\"interval\" : %lu.%09lu}", (unsigned long) ts->tv_sec, ts->tv_nsec); - if ((num_print_interval == 0 && !config->csv_output && !config->json_output) - || config->interval_clear) { + if ((num_print_interval == 0 || config->interval_clear) && + !config->csv_output && !config->json_output) { switch (config->aggr_mode) { case AGGR_NODE: fprintf(output, "# time node cpus");