From patchwork Sat Nov 12 03:22:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19092 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089622wru; Fri, 11 Nov 2022 19:24:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf5e4Ga20SWdOwcy5JIplOuJ9Z94ZNTNcosBVdwHLDHki1fxpeJ7zB0FY/hjjyQpuLf/yLYT X-Received: by 2002:aa7:c983:0:b0:461:c6e8:452e with SMTP id c3-20020aa7c983000000b00461c6e8452emr3903042edt.298.1668223478146; Fri, 11 Nov 2022 19:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223478; cv=none; d=google.com; s=arc-20160816; b=NEO0vCBn3x3TpdSblBk+Qbjb8fJ56u9OLt72Xlxjz85bj0emDbf5E4UIGY/wjpiNzA k6aHOxaMl8OOol/IF9u7Cips4IjqH1jIHap7Z0dT08RFI8FNUuboLgVbfGTYMoEO0gtz x1aDlPS7pS88pDhQcDernNlyAgH7iAbQYBaVUUOSNr18ViMFlVOKwsr1ffaZ6dS6DeTz EE+jcf8pftVcuqeW8Ly2Yqu5VC8q72vF9GRvJZuFeVC060TYDbz9iPHFakSj8NoZZ/RF KakG7VMi+zSu732eKto3ZkBfoQv2eNR5oGawbgRakzOwwBiJ5FpHx5RKRUGPi3oRqyT0 6jwQ== 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=r0CN9KCdpK4u7NxmO5wQL4MzpD0DAJLpwtVLTuJk4vQ=; b=wMuQJTaKJHghmITgE+Z1g1HRmffvsrN8sZLnHJLcgWPmAEC0XaZTz8pAShY90Xu1qG HLtj9+EH6RI3sxEMllAJdvRdFN5XE7DMv7k4FY/XPeyykTq3d+bnc/HvWW28rnqo/NZI R7oSsmI73uutcOM0XzHcKZfnK/woKsiKo0dkV7R4uShVwp0lTobfnL6VOAkCnTl0TqXV /aIBo+ARSixp4Smqlg55sVpQLcU1N4IoXhyUrDjgBADPbiR1uO/I4VACrVWRuVs81IqG a3EszqmXoioAQkzLuZACyG+PNT4ikKtE4Qn5ads6zU5y5f9Z3djxUA6MHQ37b3HvwiwE JX6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Z6dvodBI; 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 h12-20020a170906584c00b0078e1206d934si2600406ejs.162.2022.11.11.19.24.10; Fri, 11 Nov 2022 19:24:38 -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=Z6dvodBI; 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 S234387AbiKLDW6 (ORCPT + 99 others); Fri, 11 Nov 2022 22:22:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234190AbiKLDWw (ORCPT ); Fri, 11 Nov 2022 22:22:52 -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 D845E6A748; Fri, 11 Nov 2022 19:22:49 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id m6so6454015pfb.0; Fri, 11 Nov 2022 19:22:49 -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=r0CN9KCdpK4u7NxmO5wQL4MzpD0DAJLpwtVLTuJk4vQ=; b=Z6dvodBIXjUdb9tCj4aXWOPOdkT6GbCOJdmAA+/maqCO+IkBju69uWmjHhg+RlTHlG iksnmwtHfVk01EYI7MNg3xOJWbkl6xcXgUqjJIv9yR5gskNmuOE6K4rOOj6FaKgtZOsk 2UmOFmfHZtrCo02fWNgzKBONepRjphNvMsQKBUZJIzfpwQT3IN7duWD+m7EcfcUzp2jY Z0usvoPV0eyQqUU1BbMJ9kpw5HL2ZUI52MRU8NK/wUJ+869v6mWV0b0ovqEwdwL2RG6X h3bS19nlYe6jihE7zldZG52zHgCjMB9cLUzARPYV5jYuVVjKjnawdPhKxwVS7iqnqTsw WXPQ== 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=r0CN9KCdpK4u7NxmO5wQL4MzpD0DAJLpwtVLTuJk4vQ=; b=BBL6VVVI/EJjc9MvetbuPJ3An1Lt3YtMUSrcVRT4NkXWI201CRWqCBuzX5ZIHo8mNv m5Y5zW+351PIFEiH1QlE0ACTCPwzTOxPxnbTdVBeHMoxMgqiGxPid9oSoXjza43eXpgp Cyx4dAIUlVY2Y4ljb6eEzY8zneoesF4lg0dOmHJXZf9KLgmgRd0IgC89pxewFV+OusQM iJwFou6VULSBrJ7cOR5Qd0pRZXXK3YiJuZNLdFDqBXDFjEdYCt60v3ThqpHo+og7yRCw SxVx09k2pCFezWFJM+5lnwqcICcm9TI+Lw29FrbzOv7ktA7Sy7Y2zkCeSdeHms0n80+K deGQ== X-Gm-Message-State: ANoB5pmHIJjLa1uZbzuW2P6k6RC0VafkYLxFpE9Tb8aNpwwrHMxMDJh6 x58W9KanV0avd5NsFrvUINI= X-Received: by 2002:a63:4a06:0:b0:46f:469a:249d with SMTP id x6-20020a634a06000000b0046f469a249dmr4158484pga.471.1668223369305; Fri, 11 Nov 2022 19:22:49 -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.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:22:48 -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 01/11] perf stat: Fix crash with --per-node --metric-only in CSV mode Date: Fri, 11 Nov 2022 19:22:34 -0800 Message-Id: <20221112032244.1077370-2-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?1749259101731283587?= X-GMAIL-MSGID: =?utf-8?q?1749259101731283587?= The following command will get segfault due to missing aggr_header_csv for AGGR_NODE: $ sudo perf stat -a --per-node -x, --metric-only true Fixes: 86895b480a2f ("perf stat: Add --per-node agregation support") Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/util/stat-display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 657434cd29ee..ea41e6308c50 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -534,7 +534,7 @@ static void printout(struct perf_stat_config *config, struct aggr_cpu_id id, int [AGGR_CORE] = 2, [AGGR_THREAD] = 1, [AGGR_UNSET] = 0, - [AGGR_NODE] = 0, + [AGGR_NODE] = 1, }; pm = config->metric_only ? print_metric_only_csv : print_metric_csv; @@ -819,6 +819,7 @@ static int aggr_header_lens[] = { [AGGR_SOCKET] = 12, [AGGR_NONE] = 6, [AGGR_THREAD] = 24, + [AGGR_NODE] = 6, [AGGR_GLOBAL] = 0, }; @@ -828,6 +829,7 @@ static const char *aggr_header_csv[] = { [AGGR_SOCKET] = "socket,cpus", [AGGR_NONE] = "cpu,", [AGGR_THREAD] = "comm-pid,", + [AGGR_NODE] = "node,", [AGGR_GLOBAL] = "" }; From patchwork Sat Nov 12 03:22:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089384wru; Fri, 11 Nov 2022 19:23:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf6MvfLUe93W6gWXjlV8VG8NEonhanDqSKsGtTVH1575jBVG2fj/e30MP8aTibQPXwl/P5K3 X-Received: by 2002:a17:906:6d4:b0:7ad:bd02:f491 with SMTP id v20-20020a17090606d400b007adbd02f491mr4226226ejb.703.1668223422347; Fri, 11 Nov 2022 19:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223422; cv=none; d=google.com; s=arc-20160816; b=HjT0JHeEuRnXHItRml192c7e2IItTEIDGgKhHdYNobNBflR3m2MchCldhJYndYEQtf MbLOgIC1aMbwB349j0AXbRUrANvImdiXgts1uS6kSfAexNLGrKAkZnfAwT6Zv4ab3+X8 efLo54Rra8IHSkg9GCyldZdpPwGep00Edoh4NHWkl9WOfqoV5W5WKgLS68pQFp84Gj27 UHjZ9kl/2EuoK01s42pJusbafbQwRTKpUG047YalLgFgJz3NUE2OQ4P9uGBdApypEt7Q 98HeT6lfZz3y8/mA/dxiELg1ic46QpzC1u/hC1YwFY8snR8ck/6r+qI2JjcFuYvo6cVZ +0ZA== 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=UcoM9akctXagDD4pJeclGlmLvOUIRQorPmWBAJ2dUvo=; b=aTy76VBojMlgYsttwElODG/MaLo0Dsn2E0sOwsvOgyE9TYxpLx9vezhEdJS+OyGdAm 46C5JmXvGicXbc4He3TbSjLsjfPDHvy6eFhO+Emj71MP67SbkNJKR7RgC5BoIpqFDWDA ZpWRF4v1kXgdTDybq6IWQ1K7J7YR47M0/iFvCIE0xv0vGzwCLt2sDtTrCMY15xP6Yp6i PmRnAmFtpOQ7NDRlfHBU18jCuki69DwxCE2Xqsz0ZqJ107MmOpgAYd+Oj+OncAcwf+GH Cu0ZvqXeqx3SsRrJoc3ccueZjv/7OGE+VGiAPhD/T7Iv59JMxN2debd4d1gjQE887KY4 XiQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NYGDRsGb; 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 lb17-20020a170907785100b007ae1e519db0si2755114ejc.220.2022.11.11.19.23.17; Fri, 11 Nov 2022 19:23:42 -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=NYGDRsGb; 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 S234311AbiKLDW4 (ORCPT + 99 others); Fri, 11 Nov 2022 22:22:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbiKLDWw (ORCPT ); Fri, 11 Nov 2022 22:22:52 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A37BF6A747; Fri, 11 Nov 2022 19:22:51 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id c2so5666325plz.11; Fri, 11 Nov 2022 19:22:51 -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=UcoM9akctXagDD4pJeclGlmLvOUIRQorPmWBAJ2dUvo=; b=NYGDRsGbezN7aCIRSJJau2ba0Fvlx5Y2SsEQH/7FJLRpyZrqRbuvEBaAyVtRaRlN5D EbwIOV4v+EdwQvy/CbAzTS86jTv+Bb2F52Ez0MPM1l5w1VJR7vlOOyqp0VZrhhBls2RP XafUHId5pxu7VsHQESMceuyRL32Bc4pmzgv43BrU8aKYBplRT1vIVEM3hRiitsmrDyX6 EJr7/ONsFtZBEgXCIuQ3YO6z0gCZGZGcFb5GS4+QKf0Q/IbJUc6yGnMXkLNfbmAs4xn4 +jEnPPdt0o/qh4EmFOpfWLKv+l72QT2IZ+qoAA3Bk+oaX05m/1kfyL2uRvXvqBqrnJAW wKuQ== 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=UcoM9akctXagDD4pJeclGlmLvOUIRQorPmWBAJ2dUvo=; b=SfZBP6s6X66lLIgqWEWTurld6VCmOVNL+tifpyAuIHVrmxny8Hca5iSGz9gj9JgXOj 0wEk2+JQXyIgdyQnAUfdZ+f/nqfp7lwolXFHf0TgUnqsvg9bwwtVxMKpB3W/Ua9GQAqn G/KDIoO+xqOXx/GLGNHI9aZVxBMBLdFPGVZwRl6h8T9OREZsro7PFdyM8LPKMxLW+uN6 5utLGUNgmeE+blD6dgZsQ2yMFepTPmH9K/WiD8TfXfGaWH09qFdg4ecqpcVVu7pEoYsM Dd9OJNj4V4jyCLe+pttlqrSrmt11kQx+N08PAckgdPw2NxdJYMytPq3w1ABRgFJqtJ98 sVCw== X-Gm-Message-State: ANoB5pm/fBDpPtFV0cEnGkrKfirTCWKT1Jg55b2cvjZYpfC/0rzJFQKq NXywUpOveSojg/fzzU5XLhI= X-Received: by 2002:a17:902:d191:b0:186:c483:f017 with SMTP id m17-20020a170902d19100b00186c483f017mr5332657plb.136.1668223371117; Fri, 11 Nov 2022 19:22:51 -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.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:22:50 -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 02/11] perf stat: Move common code in print_metric_headers() Date: Fri, 11 Nov 2022 19:22:35 -0800 Message-Id: <20221112032244.1077370-3-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?1749259043330116297?= X-GMAIL-MSGID: =?utf-8?q?1749259043330116297?= The struct perf_stat_output_ctx is set in a loop with the same values. Move the code out of the loop and keep the loop minimal. Acked-by: Ian Rogers Signed-off-by: Namhyung Kim --- tools/perf/util/stat-display.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index ea41e6308c50..c7b3a1e10263 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -837,11 +837,16 @@ static void print_metric_headers(struct perf_stat_config *config, struct evlist *evlist, const char *prefix, bool no_indent) { - struct perf_stat_output_ctx out; struct evsel *counter; struct outstate os = { .fh = config->output }; + struct perf_stat_output_ctx out = { + .ctx = &os, + .print_metric = print_metric_header, + .new_line = new_line_metric, + .force_header = true, + }; bool first = true; if (config->json_output && !config->interval) @@ -865,13 +870,11 @@ static void print_metric_headers(struct perf_stat_config *config, /* Print metrics headers only */ evlist__for_each_entry(evlist, counter) { os.evsel = counter; - out.ctx = &os; - out.print_metric = print_metric_header; + if (!first && config->json_output) fprintf(config->output, ", "); first = false; - out.new_line = new_line_metric; - out.force_header = true; + perf_stat__print_shadow_stats(config, counter, 0, 0, &out, From patchwork Sat Nov 12 03:22:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089485wru; Fri, 11 Nov 2022 19:24:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6nRUh2uv7N3vsZDYm9Tanq0jecq5lNvJpLq1M378Q7cTC8+so/bnGRjO5fCbxSLcePhAfF X-Received: by 2002:a17:906:492:b0:7ad:bb54:75d3 with SMTP id f18-20020a170906049200b007adbb5475d3mr4022771eja.484.1668223441023; Fri, 11 Nov 2022 19:24:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223441; cv=none; d=google.com; s=arc-20160816; b=tDOjQn10kD0OP+w51+i91J45Ev5FdvMe3JuZu6ERebO04MjEqmZ/z/x9MrZ6gI3bf9 93AJ+9WAoGhYzA4kHUiv2t+PVdiGN9slrM9YOTUN6y5fauQoCf/Ttylm/dixswGZa2HT MBVwLVOrLUr9M2hKpzaGqa390EqovqqudAbl6NNQWEaL7EsfT43gqdI5tsfJqc11/tsX f1D7X1e47xCDP/dPmaTo8KIrsWt/hzf1WvGCIgpgsYVHm6GjnzmHoVd/uqKPdlU4Y3GE +3eAomz3lZnTYPU17grBmTZ+ByRy1WN0ZuGf7jO+FnWrcy5YAhC4qBkXRAYJgO3kjmvN Wtdw== 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=AxQ/iN4XHg0FIQpCgFQhcD29e8GRZB9Mx4/w+wLAp6k=; b=KEmglfDXRAphFbsTjb3COzwXLRh7h5kAUIM6xExXicG2Rw3hkY/n6QlODHtjA/WNUQ 7F3u9+3nuG6iG9tAZ7aUyqAPAXTdERC0iRqmitv2S+T6jlUUCX0UwyTMWEiOsQ5PTUYc /6D9WNrFz7Nh9e91SiUNptjKNOTx64jYLPi3CRjwKWA/9rhdlkrS9auEVI8fdZovshgY 2v6m1xbj1BP75j+M0zguGkdj9heuZWcV3SwI8TvrvfsvAJ2iY5XCLA/OeIEXfyO6HUYx aN4mgA/gLx4uHBuHE9QMe8PYlOIV2dP3gtIgXCfjXTAmEjs8pfBYtaChsN5Y+xeKSsRY L+Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JpwS4rTV; 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 ec16-20020a170906b6d000b0078db517075fsi2956700ejb.659.2022.11.11.19.23.37; Fri, 11 Nov 2022 19:24:01 -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=JpwS4rTV; 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 S234503AbiKLDXD (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234255AbiKLDWz (ORCPT ); Fri, 11 Nov 2022 22:22:55 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 859836A77E; Fri, 11 Nov 2022 19:22:53 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id u6so5662064plq.12; Fri, 11 Nov 2022 19:22: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=AxQ/iN4XHg0FIQpCgFQhcD29e8GRZB9Mx4/w+wLAp6k=; b=JpwS4rTVbq8z4URe3Q/HHFLpCAKd2Y/ZmR5sUXhhacWWYfAhrucKxKvtTb3iAIpmlp 8SugwyqwsG/VR0tEFc+1XrY7J7z/9R+feg2280FzJD3Xyl4v8lwKK7Yovzub28hH87u7 pyU8GRNXRNVpdB6uV3z0CrPcMULbxXgZK9mPwmvR1t3Uf0al+sb2gsGzXjBtYQUw89iA XTO9BRSjAxP1JzE/xRk2VYj+hwLoia/AbS29KdaetGoRPO9A+veHM+wzYcotOV/g24yi K587VZ39Qz38Eyw/VO3rXfFYBRKLFjGmb9xLntew7xeK7839Mav4n+c/CKmQkujuYlAb 5aqQ== 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=AxQ/iN4XHg0FIQpCgFQhcD29e8GRZB9Mx4/w+wLAp6k=; b=e6eCvupmrAEep+vRywa7ctLyj3TXHyjxvMvqK6NzNY0E6xlJhWY6kgIvy6paD6ndEG WCcrlx4I3lo8wvU+FuFxrPc5EwbfUkyzU+MRhisbGNZeh8cVjUwXQisTMjdTPNJXFAVP AOkmQJMxg06/XppGptIOycg5kkZnTSgcF044/QBAFGvlBSkzrX1hqaMvQXOcwuDaISzJ ltHIZj/U/4htps7znTWvD4ktcblU5Bm1TYmXnNSs86Cyykm+8UXDxFDNrAKjk5H5bfBu GFPt3M/Cetz+x07dcpSYpHCt/JfQFDWbl7isO6/l0chI3zUKpJczHWPTkBvSTQZ+8/OI 4ysw== X-Gm-Message-State: ANoB5plz/xht8BQRew4YQ3fF/SRjSwlwtc9acI3vjbg28JWKs505fBeL iR81ezuuDArwyL5WlErfbvs= X-Received: by 2002:a17:90a:eb92:b0:213:32de:be32 with SMTP id o18-20020a17090aeb9200b0021332debe32mr4973130pjy.2.1668223372955; Fri, 11 Nov 2022 19:22:52 -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.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:22: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 Subject: [PATCH 03/11] perf stat: Fix --metric-only --json output Date: Fri, 11 Nov 2022 19:22:36 -0800 Message-Id: <20221112032244.1077370-4-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?1749259063179021143?= X-GMAIL-MSGID: =?utf-8?q?1749259063179021143?= Currently it prints all metric headers for JSON output. But actually it skips some metrics with valid_only_metric(). So the output looks like: $ perf stat --metric-only --json true {"unit" : "CPUs utilized", "unit" : "/sec", "unit" : "/sec", "unit" : "/sec", "unit" : "GHz", "unit" : "insn per cycle", "unit" : "/sec", "unit" : "branch-misses of all branches"} {"metric-value" : "3.861"}{"metric-value" : "0.79"}{"metric-value" : "3.04"} As you can see there are 8 units in the header but only 3 metric-values are there. It should skip the unused headers as well. Also each unit should be printed as a separate object like metric values. With this patch: $ perf stat --metric-only --json true {"unit" : "GHz"}{"unit" : "insn per cycle"}{"unit" : "branch-misses of all branches"} {"metric-value" : "4.166"}{"metric-value" : "0.73"}{"metric-value" : "2.96"} Fixes: df936cadfb58 ("perf stat: Add JSON output option") Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/util/stat-display.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index c7b3a1e10263..96ad0c71adc2 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -430,12 +430,12 @@ static void print_metric_header(struct perf_stat_config *config, os->evsel->priv != os->evsel->evlist->selected->priv) return; - if (!valid_only_metric(unit) && !config->json_output) + if (!valid_only_metric(unit)) return; unit = fixunit(tbuf, os->evsel, unit); if (config->json_output) - fprintf(os->fh, "\"unit\" : \"%s\"", unit); + fprintf(os->fh, "{\"unit\" : \"%s\"}", unit); else if (config->csv_output) fprintf(os->fh, "%s%s", unit, config->csv_sep); else @@ -847,10 +847,6 @@ static void print_metric_headers(struct perf_stat_config *config, .new_line = new_line_metric, .force_header = true, }; - bool first = true; - - if (config->json_output && !config->interval) - fprintf(config->output, "{"); if (prefix && !config->json_output) fprintf(config->output, "%s", prefix); @@ -871,18 +867,12 @@ static void print_metric_headers(struct perf_stat_config *config, evlist__for_each_entry(evlist, counter) { os.evsel = counter; - if (!first && config->json_output) - fprintf(config->output, ", "); - first = false; - perf_stat__print_shadow_stats(config, counter, 0, 0, &out, &config->metric_events, &rt_stat); } - if (config->json_output) - fprintf(config->output, "}"); fputc('\n', config->output); } @@ -954,14 +944,8 @@ static void print_interval(struct perf_stat_config *config, } } - if ((num_print_interval == 0 || config->interval_clear) - && metric_only && !config->json_output) + if ((num_print_interval == 0 || config->interval_clear) && metric_only) print_metric_headers(config, evlist, " ", true); - if ((num_print_interval == 0 || config->interval_clear) - && metric_only && config->json_output) { - fprintf(output, "{"); - print_metric_headers(config, evlist, " ", true); - } if (++num_print_interval == 25) num_print_interval = 0; } From patchwork Sat Nov 12 03:22:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19090 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089530wru; Fri, 11 Nov 2022 19:24:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf5TvOQkjL5jkjHzgt68wEevcQBUU/sYq4omCXNd1L5EllwTsJw/akwWYrw2jC7w1bRkIRGG X-Received: by 2002:a17:906:434f:b0:7a6:fc0f:6fe6 with SMTP id z15-20020a170906434f00b007a6fc0f6fe6mr3829032ejm.694.1668223454261; Fri, 11 Nov 2022 19:24:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223454; cv=none; d=google.com; s=arc-20160816; b=M4H6Gfnuhv38fXVnnW6+cd+GvJ8004xUoxbeaQQIGCRYSLHO5wcT0k3zu8bz/ISKWs iBCosChuKC2c4ofCF9HqxsuBr4KEwsbGmV/vMBus7qmLs5LVmg1PmfCi3YiBnV6kLA5j Zrau4jwYSrN/oCyNb2F3ybwW2/HwDIdoJMugrAgMd++/P690FSjc4hTFfA2aH1I4zs4E 3KSzsa4zBfSV4boIFnWaax/lHY7wEeuVsseqeJ1REgW26k8J6D9AW0gqiVAvHRKup/pP vEZDPIbbiM8hHEMKNZvO7wlwx6Gr3Q59e0GNaF4ScBwJXAqSYN5nmi+l1L7KABgHAwt3 oMpg== 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=LQLHI1VILRgMSu/jKiHmF9iPDf4ibjWi9PVbqPg9gSo=; b=C4bJLYWvXE58HDtdnb3171bguBeaFjpiGBBqDJTpgS5/XiEl98IY4zWDqzz75LHRMO ymxk5GMWOylgcQQ5srRQ8j70HSauumyYDtm29EVL0/seL8ksyQxc9HaF7CoJdYEgkPyO vrmtwSbwNZIGgO5OMneD+PC9fVK+ztiymMofjU+56+vxikdU7Xk/joZx7Qd7n10oCycE oPQgVaDnidhuGQlF8I63te9oyIR0HIZFczoovvFnWxvXWCmAaQ7jbpP43alQbDxDuKWu 6E/OCG/W/VoEc1s6BNE8uTmQa5WcrDc+/YQPRIHF+2VvaKzKKuFBqHHExdt9cjf0J3q+ TtWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UsCcGGDG; 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 a21-20020a50c315000000b00461ea502defsi1167103edb.350.2022.11.11.19.23.50; Fri, 11 Nov 2022 19:24:14 -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=UsCcGGDG; 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 S234545AbiKLDXG (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234250AbiKLDW4 (ORCPT ); Fri, 11 Nov 2022 22:22:56 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F536BDEF; Fri, 11 Nov 2022 19:22:55 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id r61-20020a17090a43c300b00212f4e9cccdso9259941pjg.5; Fri, 11 Nov 2022 19:22:55 -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=LQLHI1VILRgMSu/jKiHmF9iPDf4ibjWi9PVbqPg9gSo=; b=UsCcGGDGGhfTo+D44aLiaSYlWe2328dlot3oI5NEGpGnSb++qvwFNLDtlB+UVBqMML hhuFPLzTUf0ejOG1uhfd2GVH2OW1/J/haXHpDOh2z5HFmTZ5Y1lkWietE5VrqNlYgvdn Cece/NY/SjugMB6Adrg6ZqsR3YZJltAOybC5zSAZSmSK2VsOIQqMH1C58NHJXyGzOIGm pjd456XTbMWqTL9IH6g9+fmcEQV409Q+VyFaVePZq71r4R3hfGvzyBGU+xLVY7J7QLy9 bYI/LLd8uHPO1arOSrNvreagsxk2gBTsfBWt2vYa7kuHHitCl749LNwWCov+5EnC9MV9 KQ+Q== 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=LQLHI1VILRgMSu/jKiHmF9iPDf4ibjWi9PVbqPg9gSo=; b=I8K9Mh3/56fWmHSV6vaKPfoyuSEydBYsEYb5uFu7Q6DBUSHVJAX1+0bqjtHoQJiPqd E1HlVBvdL2p37tdtouNR/mFlwa+7QVtB2iW+eTuefYOlSLc5SzXdtlII+j+vxOQVCWTC /w/jodvh07feuSO9ZOgrymwJABri9UmViInNOmSyd+Jobf4UwEorvyEIYPX4WaXt78Ff 8imMll0G3N9W0hs979tnTDCOJdYAjDX3N7qjKJdHwpQClP60Etpi58wKjkIe090gAuc3 T9ujCggjIoKEXDUytJPzwD03gUcoPp+btrATy+AA/BsxpkbYxxqPQE+e5rLbN+piwXgu CF6A== X-Gm-Message-State: ANoB5pk45tgBXJDKVJJ60qHnN0YvIuwycJWSXiwwCqJIgs2ySrZuYi1q Gt98HK5Olv7JzbPqmCPEirU= X-Received: by 2002:a17:902:c651:b0:187:3bc8:fc56 with SMTP id s17-20020a170902c65100b001873bc8fc56mr4956125pls.83.1668223374900; Fri, 11 Nov 2022 19:22:54 -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.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:22:54 -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 04/11] perf stat: Increase metric length to align outputs Date: Fri, 11 Nov 2022 19:22:37 -0800 Message-Id: <20221112032244.1077370-5-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?1749259076756848728?= X-GMAIL-MSGID: =?utf-8?q?1749259076756848728?= When perf stat is called with very detailed events, the output doesn't align well like below: $ sudo perf stat -a -ddd sleep 1 Performance counter stats for 'system wide': 8,020.23 msec cpu-clock # 7.997 CPUs utilized 3,970 context-switches # 494.998 /sec 169 cpu-migrations # 21.072 /sec 586 page-faults # 73.065 /sec 649,568,060 cycles # 0.081 GHz (30.42%) 304,044,345 instructions # 0.47 insn per cycle (38.40%) 60,313,022 branches # 7.520 M/sec (38.89%) 2,766,919 branch-misses # 4.59% of all branches (39.26%) 74,422,951 L1-dcache-loads # 9.279 M/sec (39.39%) 8,025,568 L1-dcache-load-misses # 10.78% of all L1-dcache accesses (39.22%) 3,314,995 LLC-loads # 413.329 K/sec (30.83%) 1,225,619 LLC-load-misses # 36.97% of all LL-cache accesses (30.45%) L1-icache-loads 20,420,493 L1-icache-load-misses # 0.00% of all L1-icache accesses (30.29%) 58,017,947 dTLB-loads # 7.234 M/sec (30.37%) 704,677 dTLB-load-misses # 1.21% of all dTLB cache accesses (30.27%) 234,225 iTLB-loads # 29.204 K/sec (30.29%) 417,166 iTLB-load-misses # 178.10% of all iTLB cache accesses (30.32%) L1-dcache-prefetches L1-dcache-prefetch-misses 1.002947355 seconds time elapsed Increase the METRIC_LEN by 3 so that it can align properly. $ sudo ./perf stat -a -ddd true Performance counter stats for 'system wide': 233.70 msec cpu-clock # 11.714 CPUs utilized 320 context-switches # 1.369 K/sec 31 cpu-migrations # 132.648 /sec 482 page-faults # 2.062 K/sec 38,414,140 cycles # 0.164 GHz (6.65%) 13,656,335 instructions # 0.36 insn per cycle (20.31%) 3,594,871 branches # 15.382 M/sec (34.06%) 124,071 branch-misses # 3.45% of all branches (47.74%) 14,016,847 L1-dcache-loads # 59.977 M/sec (61.42%) 789,534 L1-dcache-load-misses # 5.63% of all L1-dcache accesses (65.98%) 315,353 LLC-loads # 1.349 M/sec (47.13%) 171,244 LLC-load-misses # 54.30% of all LL-cache accesses (41.98%) L1-icache-loads 2,591,299 L1-icache-load-misses # 0.00% of all L1-icache accesses (36.10%) 60,421,987 dTLB-loads # 258.543 M/sec (27.47%) 123,843 dTLB-load-misses # 0.20% of all dTLB cache accesses (18.88%) 38,289 iTLB-loads # 163.837 K/sec (10.34%) 21,631 iTLB-load-misses # 56.49% of all iTLB cache accesses (2.53%) L1-dcache-prefetches L1-dcache-prefetch-misses Acked-by: Ian Rogers Signed-off-by: Namhyung Kim --- tools/perf/util/stat-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 96ad0c71adc2..3ddc159df4b2 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -218,7 +218,7 @@ struct outstate { struct evsel *evsel; }; -#define METRIC_LEN 35 +#define METRIC_LEN 38 static void new_line_std(struct perf_stat_config *config __maybe_unused, void *ctx) From patchwork Sat Nov 12 03:22:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089557wru; Fri, 11 Nov 2022 19:24:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf79ezKbpqyPopAJ6ojOPzF8PFAAwRI5zc5eRbxoFd/c7qdjXtHUAlvmKhU0aocZPnlud0xI X-Received: by 2002:a17:907:b60f:b0:78d:9f25:6103 with SMTP id vl15-20020a170907b60f00b0078d9f256103mr4111860ejc.168.1668223461145; Fri, 11 Nov 2022 19:24:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223461; cv=none; d=google.com; s=arc-20160816; b=tnACa9VuQpbVMMtBLl+M2PIuit99kIcnKjozMWfjWcd4PH9A1Lo6uokN/5FatlLviM gWZDMaIgX1XkLjpFxOp9sMKNY5GZZaEESe/keEaAMiaro+OQtL4747552113uoigleJO hD+eQ9/lybh8rRQ5PpayDo2RcNY2FBOzb5i8aS2MX37s3mqOLOlzRIge1AQWHrFy++Os HJvnLrwSkb7BNW38rJAkrN07OQxQATHWCzpBQuAdyGisMBCF26fZQ3mY8XTWpQAcvy6t X7ih/bYDBabtuQfxoKvGwRUpcCEwr3+0zC9YJ1zkgDXItFta5eP+Ss14nncpvirWqcGx c2zg== 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=rt0OZoaxk4oNSiXVua0yf4Wn8zR1kll8hc9QqXyH+pA=; b=AUKpJbnECE7rVTR0QRvhrX4ZfbVqUx+oKp6ub9xSdFW7zvqbMrP55jAe7F6Trq/DUT 0fvF8RcjLmRDs38uuonYPq0OoPj0DosqowqV3ifU6lhb9ezuzuYnN2SeEwvm6ti+b6yL rfGoXVO91rzwr3nTdPJWd5uimqltCUH7GBpbzRGwh61sMj3wpl9mMsoI23JOY8iARTsY Jh/6j+7NpLNUGKCaq2hJ8NCVT9+RW2qZeCrW3KEUUTLpujiTcrC2MbeSKfPxNZ9XwV5b 5zvwTuLSxztqUsG82v0F+9qFHA6WXS0Ab+axvjdo889DLXQDG/mEN9+uLZsAo/qtdHLo +1Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UOLbFmT5; 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 y12-20020a50ce0c000000b00463153e1627si3419652edi.146.2022.11.11.19.23.57; Fri, 11 Nov 2022 19:24:21 -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=UOLbFmT5; 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 S234551AbiKLDXJ (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234252AbiKLDW5 (ORCPT ); Fri, 11 Nov 2022 22:22:57 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 501D96BDEF; Fri, 11 Nov 2022 19:22:57 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id 4so5730035pli.0; Fri, 11 Nov 2022 19:22:57 -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=rt0OZoaxk4oNSiXVua0yf4Wn8zR1kll8hc9QqXyH+pA=; b=UOLbFmT5ToNAoU3oPqqERXV5uMrPQHnO6gCJI8tQqh9v7o8jFkF5sgAzfSAWDG6InF l3ATOCc1++/TBvjiELfNQhZLn1wBtovjj0FqUIsQIMaFBV7B265HLHDIk4a8vxaZvMMp SPPnyIiNweg1NQ5W2X0lR5WWJmc2zqdRZQD0njN/0r9NfrSqz8eW7tFSZ0ZwNuvdH1eO 2q+uBE43cMrIHHElSIuJKdAO7VPhCW7xBSTD98Q/OOLPTMtJmEOFyuR3QnlGmEvEUJ/v BbRqwHcdfb89H608XYwh2esOsLAEGjwNQIMlKQFHklbzK4M3Kxp83i2WOgKsmHBwGZMk kKtg== 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=rt0OZoaxk4oNSiXVua0yf4Wn8zR1kll8hc9QqXyH+pA=; b=c/6ToJCf3CbQK3fHwCWdixZFyU8sZvn7zdInM4WKBtO4rJjqj/xNN41K3HBzgSta9+ 3+RczZcitl3HilLVMEWvmjEuK70cgQ6d3zD4pBy8b1hOITN2KGsFwQZyXRubGSADW3I+ oR2Z7ZuCgcVcEVKPUAA9Wjbl+MeoEt5WexVqC8RgI/+Uxer1NPmKaafFbnYqr/GVNRTF mAKJW4GnMTN2jTjtdU2c5j5GEPNBrpnfdFyGX5dAETDTJYQGDVgG13eWOumkZNX6Micq q1rq3UUleda4YFpFwZZcHoFPaeTq28nZEfTMQTiC1KpklEBR84ROs7fYv1YbWk5N6wMb +5ig== X-Gm-Message-State: ANoB5plHbetTn7ujbyUH7EWDhLWp56FdyfKU2udY54CDWM66cmZDXJpt RRtkTVz8ENrDwcf+gerKB9c= X-Received: by 2002:a17:90b:3c4b:b0:215:f80c:18e6 with SMTP id pm11-20020a17090b3c4b00b00215f80c18e6mr4908393pjb.45.1668223376717; Fri, 11 Nov 2022 19:22:56 -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.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:22:56 -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 05/11] perf stat: Clear screen only if output file is a tty Date: Fri, 11 Nov 2022 19:22:38 -0800 Message-Id: <20221112032244.1077370-6-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?1749259083755369208?= X-GMAIL-MSGID: =?utf-8?q?1749259083755369208?= The --interval-clear option makes perf stat to clear the terminal at each interval. But it doesn't need to clear the screen when it saves to a file. Make it fail when it's enabled with the output options. $ perf stat -I 1 --interval-clear -o myfile true --interval-clear does not work with output Usage: perf stat [] [] -o, --output output file name --log-fd log output to fd, instead of stderr --interval-clear clear screen in between new interval Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/builtin-stat.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index d5e1670bca20..1d79801f4e84 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -2403,6 +2403,14 @@ int cmd_stat(int argc, const char **argv) } } + if (stat_config.interval_clear && !isatty(fileno(output))) { + fprintf(stderr, "--interval-clear does not work with output\n"); + parse_options_usage(stat_usage, stat_options, "o", 1); + parse_options_usage(NULL, stat_options, "log-fd", 0); + parse_options_usage(NULL, stat_options, "interval-clear", 0); + return -1; + } + stat_config.output = output; /* From patchwork Sat Nov 12 03:22:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089625wru; Fri, 11 Nov 2022 19:24:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf730hPR/WP3b+7mYabVjhpENnr2lX+2AI1fUH+q6YC2AO9VfdKaYtK+dGJ53qRooqE1Ul1s X-Received: by 2002:a05:6402:380f:b0:45a:3c66:b0e4 with SMTP id es15-20020a056402380f00b0045a3c66b0e4mr4031628edb.33.1668223478534; Fri, 11 Nov 2022 19:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223478; cv=none; d=google.com; s=arc-20160816; b=saY62sTzEeLKr6Sqiso0qcdiYBfaUHW2JWYzo+735JRIcX8e559McRU93+PioV2XqK Mf5esyHZ7mg7/Ud2c37zhwpSgBzHQZ/as7BnRprbQSQkH6PJyQIL/+nr94hugOqtjml+ ELJ1WmC1rqZdHsSgI7croje/PBgT1d+wdzB2mDjpuMA6k7wTfjM3np/P0fvaXOuK0tvd nK9tMvifrCvVs00u5pcUjUkqUhOJ31micX3XIJiLoTUphapcVwuRckFgrf4T9aWpuRrp zLWDSvlTWdL/ObKiXdOgWA7kJ84mNkGqVZRHMKxgXZp3EQwEnULMC/pYnsH43a7S3Yt3 C3fQ== 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=mRuX+j+EX9l8i8hDmmemd16C6a6HV399XyOmvJyZheQ=; b=qb1sKVPRZKuYfH8EgZCpUj1NS8RRJdr2n71Sue0D7EGQonCuJse7qR6o0k1n8vHzCj BUhJq2os3epeY4MLDGX/++6gINLAKUBtXrjJpQqqbxOQFfmsRyCPBu8SDzggRO8Fuozd A1A1U043iWd457oX6ubdIFLuJTVxSSZ5c2PCtHIOMbVzDibqzxNZB2lwYAEIZxFxqFWB pZVvG4C7Lt1vuLsSi6jKmI+sYD8bxtiJWkVc9j29c77Okn0eZk6WoC2Havv+r00BFt1b F/ZK3otW9fBHwRdSO7d3JJOb/fNFwR5r2vO5pi3dVQkGPa2fsymZhVzMPv8mUjBXspiZ HCpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eCmqycyV; 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 mp36-20020a1709071b2400b00780a882d337si3883427ejc.480.2022.11.11.19.24.15; Fri, 11 Nov 2022 19:24:38 -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=eCmqycyV; 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 S234515AbiKLDXM (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234425AbiKLDW7 (ORCPT ); Fri, 11 Nov 2022 22:22:59 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B9AD6CA1D; Fri, 11 Nov 2022 19:22:59 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id o13so5795786pgu.7; Fri, 11 Nov 2022 19:22:59 -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=mRuX+j+EX9l8i8hDmmemd16C6a6HV399XyOmvJyZheQ=; b=eCmqycyV6SF4+MBfj8mZjtXU83WS4vKKwxamThMHBx5bhoGOBddHio63RFoG1x/S6q dduEPCFh01zoEp6IVarbUn5JnQhJejBfO5ppqWTHXHQl5drY0pxIDRtZgdKAxuuwkIJq 0vUkrfCXO+f+KeIf9WJ2UCfW7T8/2RnrOGw+bBS2R+5rs6zHezmlhRPOimkiiHLdOyip kTQPUFtBQJgC77VAgAxF56CH6ITFZ8hV4HWQWPJsD9rje8WvhIfmt3nWUIbx+VbpdqCc JBt8x8P0CKxwmOTPf5vzF1EWE4PQxoIC6zmDQH07uOQG2SxDDFh2nWSSS5A/H55+Jy+N VD8w== 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=mRuX+j+EX9l8i8hDmmemd16C6a6HV399XyOmvJyZheQ=; b=PfMltaOb7ltalhSghgXoEJ+krMOldG+CQfutiSaaS15SxB2BB/1ckdXtWpU+/FvgYV 5f4EQz+ue6nN8iPy+oYMvASEC9x49X3dhPdzJHWnPCEISgDMgt0vNjIXwQ72s3OXIIwQ /mS2UZ0U+/usME12ryHmpquwZfyh3/+eVNtbJunWwTaWrO5Xv1rzWBTpudMiKqNm0kgO yuBpR/qJ1FFGk97P81zur9e6Ht/LQ2QjmTGgtBc0T/or6onsYveZHIH9EnINpdXjP1ci tolux5t5vRUr+pyrtJCevP3AltHjZeNw2oNmXMnFziun3jpHpxouBjjg1Ur5uvmXel8h 9BYQ== X-Gm-Message-State: ANoB5pnc2NG23EvtRy8Nyi7n8Z6/arDbbaoE1Ip2ls0rwYG3IjNN2nwO YlO1OKFDHbb/ME8N7N6DENSRGlFRoXQ= X-Received: by 2002:a65:498c:0:b0:46f:918e:7338 with SMTP id r12-20020a65498c000000b0046f918e7338mr4179286pgs.8.1668223378601; Fri, 11 Nov 2022 19:22:58 -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.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:22:58 -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 06/11] perf stat: Do not indent headers for JSON Date: Fri, 11 Nov 2022 19:22:39 -0800 Message-Id: <20221112032244.1077370-7-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?1749259102135045824?= X-GMAIL-MSGID: =?utf-8?q?1749259102135045824?= Currently --metric-only with --json indents header lines. This is not needed for JSON. $ perf stat -aA --metric-only -j true {"unit" : "GHz"}{"unit" : "insn per cycle"}{"unit" : "branch-misses of all branches"} {"cpu" : "0", {"metric-value" : "0.101"}{"metric-value" : "0.86"}{"metric-value" : "1.91"} {"cpu" : "1", {"metric-value" : "0.102"}{"metric-value" : "0.87"}{"metric-value" : "2.02"} {"cpu" : "2", {"metric-value" : "0.085"}{"metric-value" : "1.02"}{"metric-value" : "1.69"} ... Note that the other lines are broken JSON, but it will be handled later. Acked-by: Ian Rogers Signed-off-by: Namhyung Kim --- tools/perf/util/stat-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 3ddc159df4b2..dbd3ba380c9f 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -851,7 +851,7 @@ static void print_metric_headers(struct perf_stat_config *config, if (prefix && !config->json_output) fprintf(config->output, "%s", prefix); - if (!config->csv_output && !no_indent) + if (!config->csv_output && !config->json_output && !no_indent) fprintf(config->output, "%*s", aggr_header_lens[config->aggr_mode], ""); if (config->csv_output) { From patchwork Sat Nov 12 03:22:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19094 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1089726wru; Fri, 11 Nov 2022 19:25:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf77xCimbzlQkA1qxQ0ScOfFE2Qn1oOGPCGkxidrWp+LkEbkeGiXtCMSKW6EjtLuBPgnsRqv X-Received: by 2002:a17:906:16d0:b0:7ae:31a0:5727 with SMTP id t16-20020a17090616d000b007ae31a05727mr4057866ejd.540.1668223504173; Fri, 11 Nov 2022 19:25:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223504; cv=none; d=google.com; s=arc-20160816; b=PPqZTWb7a4/ps/scynB0wMCr2bkqyjtzEN7hUP6wwMmRbwaR+ViCPcqBWJHalPgqzS CsXVHk8si1ZZJcHRN2hoai1jyqDK6pfAwy1daYQUf4VGN8MXXO52wrN1KOJszdLscxDT S9wdXj30MGEbV/nk954ClI5YM56GPRUGnppsef1QGsHhD5HczMoVoAZY9xGZinA2E65L a/ehpofMKZxZOpExTGLKamzFzkpSbA5eVDosddp+hizro9zUBksr9htFTv8yLNoquDki JDKbzsKLRWj44EbkGLZHkay4PPGt8A/YP0uJdevniExFeX3cMgUiuft9K6BvUBgXYZM6 wQLw== 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=QbEusILygfyXCEYiRvFZYs6C5FIrT8mquksHXk+bSQE=; b=ce0dotqg/BVl81TNZh8NEMGrGwcV+hQDxw9yC5yDoF3jQl2KdX9YpPLbLpeoBufuxF CS9GKmhyvcISBrkx0xsZAptRthpB6pGYeewN69YEHQZLF65oWX6LE2v3qQOq3ZkFNhLb 5C6qtjEn0SYR2ymkfNJdxOlXWcAWk+i4r0RUAdxL0tmVZ1Lz/J3yAC8/tWWiJrpOSzsI g/7Wlfyrp+Q8heSjD3Ab0ozyfQknwBTjCLLULU5DasQ9pO/y6plf9b3v8Szfwq8+4lex hAU6+onWoPTrPtrA9bVf5KKq9uphkG+379jKOwp/jIqz0NatIV3qFw3hXT4sfI2X1gzs HvBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nFWYLFCB; 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 dp17-20020a170906c15100b007a9d456583bsi3486716ejc.62.2022.11.11.19.24.40; Fri, 11 Nov 2022 19:25: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=nFWYLFCB; 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 S234603AbiKLDXP (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234431AbiKLDXC (ORCPT ); Fri, 11 Nov 2022 22:23:02 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44DA16BDEF; Fri, 11 Nov 2022 19:23:01 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id g62so6401919pfb.10; Fri, 11 Nov 2022 19:23:01 -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=QbEusILygfyXCEYiRvFZYs6C5FIrT8mquksHXk+bSQE=; b=nFWYLFCBnNJIWO0i7LwEHho/IHZxZr9ZFzjAaSJ0N103+jj0CMLjuhKLu8cWWS9oox i3mEVOCCFaBd05ZpkrIjuv0ljua8sjwbR26wry1ReovQUOhTBr77hZNPPuhjuL4KqCMd LaMtQPUb/BqSPJzKQvYWILGIFyHcryi4bbwM1MiGvs2oQUC8AEhxjd1awBVSRwLLKR6R 34kNGr/yJvQ46fN04rkxH6NuLnW8TFLcdHUacFb4MHlgczWUiw13wYvChLtfoLXQBOFs +fxlDveeGlTqp6I/VPRZW6FHIoV8tAjmjF7xG1H2LOb5N7LL+Nu98j49F/kIznWdz1zb kKLA== 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=QbEusILygfyXCEYiRvFZYs6C5FIrT8mquksHXk+bSQE=; b=gnF2yUYvZQ7LGprX0vSyrpFRhhnmr60i1EYV6nKEbtfE3r5BdxpaUB7X3ILGlcfK23 DZ+WUVpps3MvAIR1SZOHoI9ynwBWTeGacwbQpXB3Fh+WyPDeArulZ3UQaTQFyb5texsu wA2EiZZXExK8SONf8wv7OBVjvOufPiUbBx0ynvutKwqUjPGlMkXJKwhiRznImcXV/vLr VM1lzaVN/CHUBD7WPthkyqeSoPnmrdhOsNPYB1y3KGCop8fBX7b2OfjUclR4BMORISWN K5MDsFK2YYiJmvoC3hUrAECbIWWl/d2mjoHprcsYySOsPjEE+8HhSuEuXADoZ6Lb2xW3 6S6w== X-Gm-Message-State: ANoB5pkHPmlSby5OjHPBfAULdrA9YXnZOsXMJNx2YWhZWgS4Aa070Bnu yUbssFDWCZhtrWoxUDRaFSE= X-Received: by 2002:a63:e60b:0:b0:470:3fc2:2b08 with SMTP id g11-20020a63e60b000000b004703fc22b08mr4006195pgh.162.1668223380465; Fri, 11 Nov 2022 19:23:00 -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.22.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:23:00 -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 07/11] perf stat: Add header for interval in JSON output Date: Fri, 11 Nov 2022 19:22:40 -0800 Message-Id: <20221112032244.1077370-8-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?1749259129009129772?= X-GMAIL-MSGID: =?utf-8?q?1749259129009129772?= It missed to print a matching header line for intervals. Before: # perf stat -a -e cycles,instructions --metric-only -j -I 500 {"unit" : "insn per cycle"} {"interval" : 0.500544283}{"metric-value" : "1.96"} ^C After: # perf stat -a -e cycles,instructions --metric-only -j -I 500 {"unit" : "sec"}{"unit" : "insn per cycle"} {"interval" : 0.500515681}{"metric-value" : "2.31"} ^C Acked-by: Ian Rogers Signed-off-by: Namhyung Kim --- tools/perf/util/stat-display.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index dbd3ba380c9f..03d58277e8d6 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -860,6 +860,10 @@ static void print_metric_headers(struct perf_stat_config *config, if (!config->iostat_run) fputs(aggr_header_csv[config->aggr_mode], config->output); } + if (config->json_output) { + if (config->interval) + fputs("{\"unit\" : \"sec\"}", config->output); + } if (config->iostat_run) iostat_print_header_prefix(config); 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"); 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; } From patchwork Sat Nov 12 03:22:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19098 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1090731wru; Fri, 11 Nov 2022 19:29:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf7wzgRGG4kokSST+a+X2h2zwq2AExMIkti3DC7SjG89k2M7wWZbO0pzrvjlnJ61K6A9RzOg X-Received: by 2002:a17:906:4b03:b0:7ae:c9ae:938d with SMTP id y3-20020a1709064b0300b007aec9ae938dmr3742939eju.313.1668223753038; Fri, 11 Nov 2022 19:29:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223753; cv=none; d=google.com; s=arc-20160816; b=j4EWTmJ0LO+U6AGkFzPigrnOcADFQxMQEDWIpylz1J33DXzTgSfhNE71w2LGw7HDC3 xfLUV8pnljT77XlXNYCr2Hk24oqRhBBo42GPCOF1tnNjHNPa9rDi01RXDso/vegCW3GN AQd1QgXSXH4QbEbFhNOklYSF2x1eGS+GzZjYCPzC+5OrfchHJkA4Td0vRRFhNcthYuV7 VdC1d9OC12ecpQD2q9LJvvdfOY4GqSfPt+2dzlN4/92psjFpk0eDTB35bTPX0GJ1NWVB XB03YrpBth0MlBpzt3wJDtWQnIRfq4dIsOCii5JJk12RGQlWAsHE6v78efAzmqQ+TeMi ziVQ== 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=VTFTOX/kprKoP+hImIdGvwpMnAr8GQwZEs5VpSrhOZY=; b=hR093bNZ1Wcbur0XQe/lKNEQ8yxqGpDj6oHCKBDxhc/tmsSyy+eEk6ee8RPBWCSH25 52ufj9aN7ohpn31fhix6OJdjm/850Nq5xtu6gFsez/rBUWUraHo8pELemRAmj1PKilqg DgyO6e1++aNAEqg6R/Tg8r8z6Ia9s94A5RPbYrJ+9xEofpG2k+Ct0L2KhQnoAw94jkOn +8cVgljcNm9irA8ixLVfR3XohxMBkQW0djjX7ZZIe/tQL4VjDvv1Ra0wsx3xHRVCCeiK lVYelwy+NBSAVDIOpYCa+iJctKKdVPCOPqu9a/VCXibTHI+EVxYBSUmqdkF2CZD5GV+D 6MQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RugQCGv9; 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 hg4-20020a1709072cc400b007a65a87f839si4015148ejc.114.2022.11.11.19.28.47; Fri, 11 Nov 2022 19:29: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=RugQCGv9; 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 S234648AbiKLDXf (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234637AbiKLDXU (ORCPT ); Fri, 11 Nov 2022 22:23:20 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A4C3748CD; Fri, 11 Nov 2022 19:23:06 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id 78so5781157pgb.13; Fri, 11 Nov 2022 19:23:06 -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=VTFTOX/kprKoP+hImIdGvwpMnAr8GQwZEs5VpSrhOZY=; b=RugQCGv9Xqv2uGNErew1QtbUd7y3ngz5R+GUbaiYIxZW+RYvuEGSw3Kk6fAiUxZJZe yCiP0naoiBrkrJm+iFN3MCruAbKF4ngD20W88QHLfLQciob32aQCuKuls5lAHzISjqYL zAS6aXI/UPdzpjgXErhGaw5pf30z/JcrjbsWrmpx3iGDneLxDa87rYkLyfCB/9fMTmX8 wFkvuTdaVXSVftpB4ty3ifxJkbqLwALdW9Xo4fgm3+kyE7zuws/pqBZazHKgZde9UmjA 6caTpcpBgqTLkHSNXrKv1aJXMrEhjWAaPnjJn2Nmoc2oGiYKkPybfJ6LRLofgDb7HSKk XS+g== 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=VTFTOX/kprKoP+hImIdGvwpMnAr8GQwZEs5VpSrhOZY=; b=dz/FZLyQVpL7puluQrgD/1gipo4Yj/3d+t4mjPkpW85ykcqKcTOSh/DK+yXtRjDKFy zIXzxKuWyes5elCz6N9NPa3vSf8P9lEO3eOxjCIGupY1Nw2QQr3i2tQqPlTRfvsKQ/Fd RjAkoo2s7pR3O43l3P0I+ePG/5sMzDZx/NGEQns59FcWfTOF2mZdh7BiDi1aQ1sl39Op dwybLF7WXI6+jL6MxtijKagy5WdNavQhCM86KOJTx86fI88hlwoXJBH9kvxUr9vSJ/bQ PGPziWha4wHML5VCAZPvG4Oxbk7f1Vc1cgShpXY3mnAKk2aN10vFxk013XxyZyCmEyGY KYzA== X-Gm-Message-State: ANoB5pnMOSpZaCbInxN5/5EVBjE0AP5Ro3b70rpYwUptERpCI5mcLWW3 nUG/kZzOAQavlaT6n6X3LeA= X-Received: by 2002:a63:d057:0:b0:46e:be03:d9b2 with SMTP id s23-20020a63d057000000b0046ebe03d9b2mr3991257pgi.406.1668223385890; Fri, 11 Nov 2022 19:23:05 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:23:05 -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 10/11] perf stat: Fix summary output in CSV with --metric-only Date: Fri, 11 Nov 2022 19:22:43 -0800 Message-Id: <20221112032244.1077370-11-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?1749259389875025733?= X-GMAIL-MSGID: =?utf-8?q?1749259389875025733?= It should not print "summary" for each event when --metric-only is set. Before: $ sudo perf stat -a --per-socket --summary -x, --metric-only true time,socket,cpusGhz,insn per cycle,branch-misses of all branches, 0.000709079,S0,8,0.893,2.40,0.45, S0,8, summary, summary, summary, summary, summary,0.893, summary,2.40, summary, summary,0.45, After: $ sudo perf stat -a --per-socket --summary -x, --metric-only true time,socket,cpusGHz,insn per cycle,branch-misses of all branches, 0.000882297,S0,8,0.598,1.64,0.64, summary,S0,8,0.598,1.64,0.64, Signed-off-by: Namhyung Kim Acked-by: Ian Rogers --- tools/perf/util/stat-display.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index ce81798b5864..96bb7a42fd41 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -549,7 +549,7 @@ static void printout(struct perf_stat_config *config, struct aggr_cpu_id id, int } if (!config->no_csv_summary && config->csv_output && - config->summary && !config->interval) { + config->summary && !config->interval && !config->metric_only) { fprintf(config->output, "%16s%s", "summary", config->csv_sep); } @@ -732,8 +732,13 @@ static void print_aggr(struct perf_stat_config *config, * Without each counter has its own line. */ for (s = 0; s < config->aggr_map->nr; s++) { - if (prefix && metric_only) - fprintf(output, "%s", prefix); + if (metric_only) { + if (prefix) + fprintf(output, "%s", prefix); + else if (config->summary && !config->no_csv_summary && + config->csv_output && !config->interval) + fprintf(output, "%16s%s", "summary", config->csv_sep); + } first = true; evlist__for_each_entry(evlist, counter) { From patchwork Sat Nov 12 03:22:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 19099 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1091013wru; Fri, 11 Nov 2022 19:30:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf6tTPHwQLE2YSR7R0G596TTIxh12C+yVqufRi0pmLsTLN6RuBSA5iRJq3bOH0Xwjsm6wmTv X-Received: by 2002:a17:902:9889:b0:186:6050:eb64 with SMTP id s9-20020a170902988900b001866050eb64mr5133896plp.151.1668223822520; Fri, 11 Nov 2022 19:30:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668223822; cv=none; d=google.com; s=arc-20160816; b=IoP5Iob4o6N6tC3/tD3NNKotIfkvKHoSyUzbRinOEdYNSsIpyUEIVxZmqz2FYROAeg HAauCissSxikCQfjm5d2myUDUjCzIXCQ01gwh2r/3W7HTHGSrc1EgEwcdWQgBhpv/yZ6 ynITdUzbIo6fvM2LF+I+Hh4eyvrxJaHL4WnhwWhdujhY1diCMmaeUVnqxalG5GM8nbrw fhh/TU+YhBBks/ysXl90nC2fNi6t6My+cuK7kCyiAvaalvJqJs4dJCezlMR+5sfNgpOH 2aQ0aWxyg1/zIbGWElXgQmbnLjHFNm4fHFKmTA0Sql4zmMeXkVIrMPcnhBsiX3xVfzVO xvSw== 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=cbdcYDsOPafiPSVZSATOaxGNpCzEo4xQfFV4O82eayw=; b=snu+8+7bPdgAWCrK+/OuciIFUuLqAcTTR6xKUewYFYptOIvhmYk/QZN2fxv4C1gibH oGXlnJOvcuxm5cLLBtdn9MAHdVi/Wo8iLVLAW8e6FiE/RVU2hSh+yxsMHfHdsW+L84Fv wxzYYPPfBC1PfKuannRMk6RNfE3Y0uXEk3yLcKjxH9bL9mGLWD2ZJL/t+n2emVZKiW3y sVaTYA9b4qWXzByLPACtR8Us/X0hR9nUoIkXI7VH/6UfGteyxQM5Yvz6C3S1SRHMWAnU uVEsvencNDzfP+Ze3DOjdiKIifi+0AOJKeKpypahlejFWhbkPOkAcg00zig0UmEpfH2w YISA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=f6lJ8r26; 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 ct22-20020a056a000f9600b0056bf15d0cbfsi4188778pfb.308.2022.11.11.19.30.08; Fri, 11 Nov 2022 19:30:22 -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=f6lJ8r26; 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 S234744AbiKLDXu (ORCPT + 99 others); Fri, 11 Nov 2022 22:23:50 -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 S234660AbiKLDX3 (ORCPT ); Fri, 11 Nov 2022 22:23:29 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C15A76FAA; Fri, 11 Nov 2022 19:23:08 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id j12so5688681plj.5; Fri, 11 Nov 2022 19:23:08 -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=cbdcYDsOPafiPSVZSATOaxGNpCzEo4xQfFV4O82eayw=; b=f6lJ8r26ECT6R8yo7oa+mPmSnf0+R4JS32T/9zbBThdOT5XMFIW+6NByrFFmsWgTS1 Q6Y0NYtG5bR2FrV8ILv91bYmzP9MTKP/948C8gEuVncwxRMqTa5fZmUzrSYZN7siQ04v qI176pCpR2V5bVy5HEUXDBtBujLLF/jKHMnS7Uj6u/Cpx/GsNiF4ar5ls2fS88D0gK63 7ihLLuh0jOZaT0BF17sqY8w1YQuM01a3STrMQN8KBvO9WshWdxvbQQYOYJmeH7FT2b7d ZxB1ZoNDWfhced6wuJbm7ip71wKogU354ovn7EMzA+qe1PkdDkx1G9l8a8P9WGs0B3Ll OXYg== 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=cbdcYDsOPafiPSVZSATOaxGNpCzEo4xQfFV4O82eayw=; b=0qL7SBX97FiTstx1paFl2ZzmdDWKmFBaBEgEQtU5acARmsDWpvD5HO7d0uM31y31yq zS0T5+Umunxun/SbxSd2xSPhAl658qkVsm43zSY6inUYuttxjq5NHooNl8G/J14/a04p /MslJ7OYTmnnlXfIDwPL7WZ3QUxHIB2wJEk3jz2IWasOOS4m6fffUDg4kwmgh52mudBj r3xLBpNwvAmG/0lVic4QzD3LevMj6m68AOum0myC/VsZGVFjvRvQdeSl9E3UU6/ZTAYb N0t+2vLJ/TXdlU8QeSp7VmaVHXlcJHZL0RZHpGytmgHSaJfZxs6QDBqnLtxL+ecOfcst KfGA== X-Gm-Message-State: ANoB5pnzHkDqDi9SXFHc/Jz57R8VFAJdRdfCOVDD6SEtWyei/PKQHQIZ xJssqW9htS5E+2dZ7i8UzZg= X-Received: by 2002:a17:903:c3:b0:186:8431:ece3 with SMTP id x3-20020a17090300c300b001868431ece3mr5486622plc.8.1668223387781; Fri, 11 Nov 2022 19:23:07 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 19:23:07 -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 11/11] perf stat: Add missing separator in the CSV header Date: Fri, 11 Nov 2022 19:22:44 -0800 Message-Id: <20221112032244.1077370-12-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?1749259463200796116?= X-GMAIL-MSGID: =?utf-8?q?1749259463200796116?= It should have a comma after 'cpus' for socket and die aggregation mode. The output of the following command shows the issue. $ sudo perf stat -a --per-socket -x, --metric-only -I1 true Before: +--- here V time,socket,cpusGhz,insn per cycle,branch-misses of all branches, 0.000908461,S0,8,0.950,1.65,1.21, After: time,socket,cpus,GHz,insn per cycle,branch-misses of all branches, 0.000683094,S0,8,0.593,2.00,0.60, 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 96bb7a42fd41..a316807255cd 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -828,8 +828,8 @@ static int aggr_header_lens[] = { static const char *aggr_header_csv[] = { [AGGR_CORE] = "core,cpus,", - [AGGR_DIE] = "die,cpus", - [AGGR_SOCKET] = "socket,cpus", + [AGGR_DIE] = "die,cpus,", + [AGGR_SOCKET] = "socket,cpus,", [AGGR_NONE] = "cpu,", [AGGR_THREAD] = "comm-pid,", [AGGR_NODE] = "node,",