From patchwork Sat Nov 12 03:22:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19096 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1090454wru; Fri, 11 Nov 2022 19:28:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf7NU0z3HQVqbjR7rtwTZk3lWVtYnHoWyD3iP9n04JXElranXClmNBXdHWzLd1TY95oGnh/i X-Received: by 2002:a05:6402:413:b0:463:a83c:e019 with SMTP id q19-20020a056402041300b00463a83ce019mr4009899edv.253.1668223693639; Fri, 11 Nov 2022 19:28:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223693; cv=none; d=google.com; s=arc-20160816; b=cAQ08ssWKA83kP/XrYQPOCZXDGrs31Lzc1T17kyiRD2+eyEIMMDZ457FixuPvsXNR7 BSTWKoaUrMGvs2fvCA4nQOEKL3N6Uwm5yaPiwA2wPqSk171rYSdx5MkcqZx4w553jfDI gWp6z3B+VDW54nyX0+hbwQooG8wPrmqfBPLyyxekbHQo57kg68pYjVCG88l/x10FoqXi bDR6ptkiaPGHdt0Tz0OlZidlR9vxBsprm/2M/OucQlSYTxtCNdMOpgk/gkioYbcGJX3R k/18ikIBS67q32kEW+xaSu8IpNh3IrvPKrvMtpv5fi7KuBJoRAlWX0aA3oPS/zsYCdUd J0Jw== 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=OCrq93Ou9ulSTWplOyqr42G3tytqfI7Ze+qFafkY6Oc=; b=hSS5yvlkGlwxMSl6a+al3I5DgfM/LY0YPJEHKU9oyPXVExEmGqksd7CkcaCPiTFJHt LDukAguP/hMOWA41d37yYH+iu5NIVWv0HCugv+z+v3m1+iolCQDKpmVyjMqTRU/Ee11E wOzZEvCeyEfQ+3v+Ujrc6wNf9IjHivrHtjpEigFuk5+T17Wv2DYPSQwdwn6+rm7YVVwI z68cuZpf5vze2E5hUz5duJ5QyVaeuWOpALg+SIHlQ9M6JQlvZ4z3duwv+XWZvSx51dD9 hiXhqcgRlZYjlrAf4zslglXNS+YCKavqYs1Prd8Ci6IEtwgGvBReZUc/LuG4QO9xzzf5 x8Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YzWwQaPH; 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 du4-20020a17090772c400b00741a0c28f07si3814266ejc.943.2022.11.11.19.27.50; Fri, 11 Nov 2022 19:28:13 -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=YzWwQaPH; 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 S234607AbiKLDXb (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234489AbiKLDXK (ORCPT ); Fri, 11 Nov 2022 22:23:10 -0500 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71A6D73430; Fri, 11 Nov 2022 19:23:04 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id m6so6454301pfb.0; Fri, 11 Nov 2022 19:23:04 -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=OCrq93Ou9ulSTWplOyqr42G3tytqfI7Ze+qFafkY6Oc=; b=YzWwQaPHElVm0LGJ3HDfNkJ7OIvk7JmJcJ/5EuT2mwrgKGzvhiOv8qaFFA1M5Qs5Qb 9mhboMBUNGaoDbX/9KE147crGSUvxQHeMJRk0uSUAoSv7Z/aTk/3fkTpvvVFkKflixez 1QzQTdf5VInC8BHMH9LemeD3/a01k4YbHwdqs05qt9bPZ4ikmvi7g5AtubpcNpApamQO 8Uo1+hlOgjTBfwZAFuNReZX9A0JFPCu/w+5iKwCk87Zau8eej0p+MkQ2otIeC8Nid2b6 +amaAlsYlKrZ82qOis65OGP8cjYW399KLOegR1osuGkxPaWkFOv1J5PV0tm/lHKZAh/6 LOlQ== 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=OCrq93Ou9ulSTWplOyqr42G3tytqfI7Ze+qFafkY6Oc=; b=syTIBWQdky/2D6xrTM/TBkwZjwjZ/3iRV0CJJuUHnN+Df+vwXVl0fVclYRYtr+LsUt UyWNAZWR8SAgL6TFb4wKRZcVxMT70UDe3HuiG48PraEfxrvlTvfX9VMl2lt2QaD3O1K2 tOiI6OOuhIE6POip2ZeYYp/krTwNNXNvRONS3PGr08hmto6UxbImEmUk7MNGTcYVx+aj Vupni0km338W6660biubtdubDPqSu87fuDkGCbSx8AFyRUmjCyra1a2CWbL4lHYOl4Fc iK0GG76yWcPaqGencM043UKeXW54CF/rV+xXO8OnU9Tp8GWG3Wyh4IBzHJEgjYlJ8GJN g1+w== X-Gm-Message-State: ANoB5pmQqzHrchE7BCWlSed+Q1/sEnPbyCaXp7ZqdzbVfW89rYMiAe0/ /lztqYmEge+MeqNmVPxKDv7+49duyWM= X-Received: by 2002:a63:4b18:0:b0:470:48c0:f37a with SMTP id y24-20020a634b18000000b0047048c0f37amr4073123pga.83.1668223384064; Fri, 11 Nov 2022 19:23:04 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:23:03 -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 09/11] perf stat: Consolidate condition to print metrics Date: Fri, 11 Nov 2022 19:22:42 -0800 Message-Id: <20221112032244.1077370-10-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?1749259327801585584?= X-GMAIL-MSGID: =?utf-8?q?1749259327801585584?= The pm variable holds an appropriate function to print metrics for CSV anf JSON already. So we can combine the if statement to simplify the code a little bit. This also matches to the above condition for non-CSV and non-JSON case. Acked-by: Ian Rogers Signed-off-by: Namhyung Kim --- tools/perf/util/stat-display.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 5f4fb0bd4037..ce81798b5864 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -600,9 +600,7 @@ static void printout(struct perf_stat_config *config, struct aggr_cpu_id id, int pm(config, &os, NULL, NULL, "", 0); print_noise(config, counter, noise); print_running(config, run, ena); - if (config->csv_output) - pm(config, &os, NULL, NULL, "", 0); - else if (config->json_output) + if (config->csv_output || config->json_output) pm(config, &os, NULL, NULL, "", 0); return; }