Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6142524rwb; Mon, 14 Nov 2022 15:10:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf5V7f6J+iDtYOpmFM2LqwIqgLkh4iYFwBZxW0g8GZa739RS4vAuFEdHRUQI2Um2x3PzzkQw X-Received: by 2002:a50:ec8c:0:b0:462:719:3372 with SMTP id e12-20020a50ec8c000000b0046207193372mr12923150edr.361.1668467446510; Mon, 14 Nov 2022 15:10:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668467446; cv=none; d=google.com; s=arc-20160816; b=iFhieeuncBsW/S5exx/oeQEhPgb37RG5nNWyKMY8RXbVOwPHOWh6gxRoJhe8wBMJya odDnm5qCJLDv03d60RBi23lNljB+sgfmIXRuMracYMXxBsajBlansWJEb01WfLBypqjs bveu1nsfmqvFlSa2fXNVccH68yXQV5pfn0S5VJy+gDwocldNdbSDWkWdobocCxC9pwfo bF+tzQ9m1he6CZdWryaCR4IN9abNqEbi2RlHnQ/tP84NElwKSHhxGD9A5iPYFKLVTh1G TJvk26ycgBavp6EULOmsPzkFUn1/KRKH2FskUMhooymXNEvXg2cFLdw60+Nck/OayV/p Oe2g== 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=CC4R4Flp577u4yBTPLbgmfpC6msSDOQY4vvA3zFzeIk=; b=DEhjvphgpXwO/HNpSUe4SQLW/c3KLPiKFv49zjzk30SA5n6ODvVVERBrxVueY1fZfL NpcxF2qXCAJmOmTnUesHVClOX+v9FSa8mOzrYxMccObqbiWIpWmsX0WbFtXmwcQP0PQ1 q1sP0pCzSKBgpah2U4QUakIprgEIXRDPIPC7Q3jqoCHKTJ+u1bPcsd/MuIKUfPkMxbRO 1s1kQloHA6Alm4OveIy/LpJVTuS8eKHrMUqv3DXt4+tY04JN0lIrWeFr1dowhkcnNxXH 3bI5jE7C6IxuHQI6IlTykAIRnHhi2nOoMjZVjlfHUswyQ+oOBR5rrZQyo4SKsAQoshrj ioXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OpbUbMzr; 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 gb36-20020a170907962400b007316ac034a1si10354213ejc.831.2022.11.14.15.10.25; Mon, 14 Nov 2022 15:10:46 -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=OpbUbMzr; 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 S237814AbiKNXEe (ORCPT + 88 others); Mon, 14 Nov 2022 18:04:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238017AbiKNXDe (ORCPT ); Mon, 14 Nov 2022 18:03:34 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4D201CFF7; Mon, 14 Nov 2022 15:02:53 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id 136so11594080pga.1; Mon, 14 Nov 2022 15:02:53 -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=CC4R4Flp577u4yBTPLbgmfpC6msSDOQY4vvA3zFzeIk=; b=OpbUbMzrJ8W7hEVVcarvOE/Z8N5O0xLRBWVksEFDk8w+TmJUJBuN7uh2O91GlRulr9 Y2IWMKcTFhkUJVhxbibOpSAC9wSL+q3XdteqCdY8u8o9aNDbzpwNn+xgkqKMhE6JndJj eOLIaHKCo2mvZiryqz3tOJulC6MyA4FCMFkL3E9SH2uiGApf51qv63f2cZWG13Pe3+QK i+nI4G51mlF6aviVMx2E+auRZwyelGJYQTvR6mROKPlNiGKVqbxki4RHOlSejc+59vAo 1z/22iOILU0/QO6CvQvdtmYQa9FihbnrwI9Hw3RMQssFYVfki/0k3EimJYaukpIJ+Hm2 NVlA== 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=CC4R4Flp577u4yBTPLbgmfpC6msSDOQY4vvA3zFzeIk=; b=FLZ43eGwYjYJgWQKjEzH2VhAcrC6JTFWKfEPmhGDlFEj0e6cmocBThXDIhgjpDrGd3 +ovbKxjhFDHhUMFdpAIAFVQO/AhfRYpZX8xTo/AN+Fmr+CWR+BlUGyKn3XbSAmYyLMac iLXTac3QBTRS2Z4i9Tt+VPnx4aBDwLpCxjSV/v1kae4TEYU42+nBtC/O3lV2px297b7d 1rqTTmvix5eJL+EeRhMU7zp69Ex6g5nx6GtcSI0r8xf5969axUsWbStb+MGbuAJu9NXA Shil0WDqrc7zsgxS2/j/GxhDPOmGDREfNbcztHKnRo7FxfxVmXWb0rv4zvW96KwO14zI bpcw== X-Gm-Message-State: ANoB5plIkkGPXiuMxoS/UcB5Xr4PZSTWtG84bDFEqJbtkkd8CwN2bS++ hchXiUBnz1azcVXL6bR8XhM= X-Received: by 2002:a63:1b25:0:b0:459:5fef:a491 with SMTP id b37-20020a631b25000000b004595fefa491mr13869341pgb.150.1668466973275; Mon, 14 Nov 2022 15:02:53 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 15:02:52 -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 15/19] perf stat: Move condition to print_footer() Date: Mon, 14 Nov 2022 15:02:23 -0800 Message-Id: <20221114230227.1255976-16-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 Likewise, I think it'd better to have the control inside the function, and keep the higher level function clearer. Signed-off-by: Namhyung Kim --- tools/perf/util/stat-display.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index f97817628478..73cf898060c0 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -1205,6 +1205,9 @@ static void print_footer(struct perf_stat_config *config) double avg = avg_stats(config->walltime_nsecs_stats) / NSEC_PER_SEC; FILE *output = config->output; + if (config->interval || config->csv_output || config->json_output) + return; + if (!config->null_run) fprintf(output, "\n"); @@ -1359,8 +1362,7 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *conf break; } - if (!interval && !config->csv_output && !config->json_output) - print_footer(config); + print_footer(config); fflush(config->output); } -- 2.38.1.493.g58b659f92b-goog