From patchwork Mon Nov 14 23:02:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 20087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2410536wru; Mon, 14 Nov 2022 15:09:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf5T92OyMIH2BcEsIqVTL9QP/JAQ708yVolucQ3sFfctQGqEWH9TldlLgKQO7gApiMUIBoqE X-Received: by 2002:a17:906:806:b0:73d:7112:4601 with SMTP id e6-20020a170906080600b0073d71124601mr11700170ejd.239.1668467374389; Mon, 14 Nov 2022 15:09:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668467374; cv=none; d=google.com; s=arc-20160816; b=botMv4tMcOW1JdEeMjOBdjH5Br4pfwPoKrLSI0yNFbhWTPNCk2Ahv9msiJbi+/jYLj /GRk3RdxE2ZTDkpHloPbpZD9fqneXs1OBudetpu+72LSv+N/wSwxPXEyhTM/CQ1z1It3 uSYSMrJXSFFEuJK+5GqGGnnM5wA3V9K72lVs7XBY1WhxNRxCTIJ10s8V2WvyczBRbRBv arPTY5v+gYGLFK0MI5VRf4NZ4NLckREpakX3Kd8F2MJaEjjaZsuA66+e77wfWZqkjlU3 7Ef/Q9Rh+LGLGBvnFsiu784KB9OuO7loRVRU9OG/3gU82bm7FbCssXi0dxJ8BrFmZXrX XM2g== 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 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.09.10; Mon, 14 Nov 2022 15:09:34 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749514845306061704?= X-GMAIL-MSGID: =?utf-8?q?1749514845306061704?= 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); }