From patchwork Sat Nov 12 03:22:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19095 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089993wru; Fri, 11 Nov 2022 19:26:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf5uaRTeLFmXbdHNmRJW+wtCyV2fvX9AVMEs0zH/kSxT0+nMATxalU0TTw1++LfT6QVtO9TT X-Received: by 2002:a17:906:18e2:b0:7a7:bf8c:1824 with SMTP id e2-20020a17090618e200b007a7bf8c1824mr4137633ejf.767.1668223568279; Fri, 11 Nov 2022 19:26:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223568; cv=none; d=google.com; s=arc-20160816; b=G1fGf97mlH9rDYoxJpn/soJukkxUmqp+3ELjFRtMN6bFxy8+LtR6pGy1e5EMcb40KC kABIoiXp4DTfT9TAGlpVQAcQnyZapZgV/5VWCemMieakfuQqRBxwg37vb5kTVt8AfUmA VvNfp3PiDKaZtkR/NmzYOuYBTNEYPQAq7YVnEPamG6KH4Gu+h8Kqq9KomNNSQIbo0AXI Wi6PHHy/tQHF84xcRQEli22ui70IQI0b7Rm0iQltft1l1FnlOwmaCU/SnH6rlTI9fa8H CUlgs4JS97MM/JMKzjY9SMycOHwB1PpNBi3b7SMd10ANOo8jjQjaCi85xIeF9sN4VnGr dZHg== 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=cwipktzA369UTkHqB7XVTQckcETl9zD+7fptBSB2IMc=; b=zCFoCpXlOF1pIIS+/AbfEbKdKbAly9t1DJbrr6pehzv3jZNzOQeZE0BeOIFETecSZC cCri3LT75vh07/+Bds/9dhNNx06FGgsWM1K91TO1BHiI7DpZkbxnjK5qd2Gg7fRhkntN uczC+atgfIef57iBBsvhdRMAiIxnQ19GS0IKEdfDphkxf2wQpDc0WksMt6Mr6w2csY4z I+5VlfaBKWNYAbbW+Aq6GTM8FP+W7NRgH+2Vwd47uWUC5IcM/CZZQwptFBkqaJfG6PpW GZ5f8tHcCv+RwqzCXU7MMCRmMHTZEiscHJ6vZJDn+9Tglj6g1ZD2Q7rluleOYDkqkyNB yg2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Cs3rBx7u; 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 he42-20020a1709073daa00b00781132a4ca6si3852293ejc.850.2022.11.11.19.25.45; Fri, 11 Nov 2022 19:26:08 -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=Cs3rBx7u; 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 S234533AbiKLDXT (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234528AbiKLDXD (ORCPT ); Fri, 11 Nov 2022 22:23:03 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECAA273418; Fri, 11 Nov 2022 19:23:02 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id 130so5804418pgc.5; Fri, 11 Nov 2022 19:23:02 -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=cwipktzA369UTkHqB7XVTQckcETl9zD+7fptBSB2IMc=; b=Cs3rBx7uZU3XflfJGaDVjl1h0Fq4A3Vrrpp++T5K5t7Y1Ye75JN54ZBFPyDJH0ddxP RL7eM52OiLookCa/VVTSdytmb32vlJ8f3Bzwh6yv0qYFsZSkQUCd7E6XhIkrd5i6zNdL t/PD+DZBVYMECmKOkwO/72Jr8dP5Av6uUvGcz0Zkqb40hGebKcyEtFn3lSM/CHHuaFRX Ucc1eWlaA/C2zVg7O/BAnVHSqw1u1ZDV6zsWnHhiScg/4KObBNmbRk9kM3ziMRTmZw7g oDgxAxmPY7q9hlZ19xb7cBryLv0lDKHv8n2OaN2eMvS/lIjRihr3kmyhQUBrPFLv3UPT pCeQ== 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=cwipktzA369UTkHqB7XVTQckcETl9zD+7fptBSB2IMc=; b=0r7+64sV4GbOi+jnXw9vey9tfOltM8yL6jn6+GGZ2uZwQLizaBW/WXi+DcXO0hDu2x EhprgdcWGgQwnTH7nwGlYaT58Cwcgwof6ltCsgJerKEYasNu3MigGPjiWep5TOGWgX8r 1XnAA/CYE2aXqHZL73ikXLchmwX6OCX8EKQKrOD4osxBzLyKpFuKwlxp2wIl0HGgeeU7 AloJ2WMwHX2sQbocw/TcGTAtDSgSwbEwb/yzgM9yyrFaFkjgFob/LmXnSi146xI8avP2 C7AvkaRG/3wbrzQ8xWI10xKeMKVJgAD4Ef0TxixwLXjlkpzckbUgmlmQhXuqr0HEbgIO h16w== X-Gm-Message-State: ANoB5pkSEBS+z+9IFp8YOiXE6tNnK+4Iau1sSfbHeZzwjDMTnHJgDfBA QuN7jEYg+BxNf/pWqFPTt4Y= X-Received: by 2002:aa7:8e59:0:b0:56c:12c0:a89b with SMTP id d25-20020aa78e59000000b0056c12c0a89bmr5296830pfr.40.1668223382290; Fri, 11 Nov 2022 19:23:02 -0800 (PST) Received: from balhae.roam.corp.google.com ([2607:fb90:27dc:8408:33d7:3b01:eee1:84b]) by smtp.gmail.com with ESMTPSA id ij25-20020a170902ab5900b00186f0f59d1esm2434552plb.192.2022.11.11.19.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:23:01 -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 08/11] perf stat: Fix condition in print_interval() Date: Fri, 11 Nov 2022 19:22:41 -0800 Message-Id: <20221112032244.1077370-9-namhyung@kernel.org> X-Mailer: git-send-email 2.38.1.493.g58b659f92b-goog In-Reply-To: <20221112032244.1077370-1-namhyung@kernel.org> References: <20221112032244.1077370-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?1749259195937842979?= X-GMAIL-MSGID: =?utf-8?q?1749259195937842979?= 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. Acked-by: Ian Rogers Signed-off-by: Namhyung Kim --- 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 03d58277e8d6..5f4fb0bd4037 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");