Message ID | 20221107213314.3239159-7-namhyung@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2308923wru; Mon, 7 Nov 2022 13:36:31 -0800 (PST) X-Google-Smtp-Source: AMsMyM5/FQ1BeYZ95Glrcvs3jptjKOzWwu+1peVTckSZjN00ZSSSAXzKAlD/qXv3w4YvWleeETBb X-Received: by 2002:a05:6402:518a:b0:464:5ec3:c5a with SMTP id q10-20020a056402518a00b004645ec30c5amr21324717edd.90.1667856991131; Mon, 07 Nov 2022 13:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667856991; cv=none; d=google.com; s=arc-20160816; b=y4TSXTTcsoaO3CQkXuf3OrlfCS2Mln+H6w2CIa20dlpkPhiqr4WVUoB55nyFHDHWAk By1Gd0k1BHJ85A8sIJNvGTpdm/O9KTvTAdji57HMHdYLMSxTv1/QqLxYW9OjHJpme73T 5E1PxKzUCUhmnz0uSSzCHdyAST6u7mG91jg5c2E1w6Y/4RR1FrAIoGBqW5O5UJAQL2Iz WMLyGiR3JXh5Tc+/hNBGayh3MRPrEIGmxpJ2cLf4AfDbRq6ozGhwGgYCmqJbjo2O0Qiw Cj/j56dMg9kRfQ+kE3oOXrHy8fGDTzLzXt6YDlipeHYTL8WwuBj/DGHnaobvHoFH4Yl9 uIiQ== 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=uEwG62U2ocTRAE+zcAm5Rx1np9/Wr63UQVaH+5ioR9I=; b=QkOzUFbc4c1+PnZO4pLuPsNmVaC1x394a9nx0J37Gv5hFSWg+uRZlseD6BPa424LvZ HI6OGDJdFeTl1Y5Com+G0aGjkkPt80pSFHQAo8QYj4HxNKXpKGcPUH96RvQMOzdO0h9x Aw8ZNeXt4zOgMWTIUamRNMqhwPzju8oEP0RLIi68rcIC1wKbP2yZsAE864Nd+9fjkgBY l3gIG1OCeRpS1+e6my3MBYXZ5XXRPcPmqVcB+Igx3z+xjK3JGCibt0P4kOuHcPiOX+m8 TdbhzvJNe+2PPSfQhUp6882bxrmVFepyWv2POa0i/7PWMG8uw9f3EBNEuaD6o4ehMk7W eHqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Hc+KCEIH; 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 ds16-20020a170907725000b0078e06df0d29si8200363ejc.705.2022.11.07.13.36.07; Mon, 07 Nov 2022 13:36:31 -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=Hc+KCEIH; 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 S233370AbiKGVdr (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 16:33:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233400AbiKGVd2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 16:33:28 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E59BAB1B; Mon, 7 Nov 2022 13:33:26 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id b21so12303325plc.9; Mon, 07 Nov 2022 13:33:26 -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=uEwG62U2ocTRAE+zcAm5Rx1np9/Wr63UQVaH+5ioR9I=; b=Hc+KCEIHI0yjOOxQWtJwjkjcfiZXxl/jTVZifw/Fon9yqTKXtKv5u4DbvdbdDg7b0G kG8o1emeN56chtVXqrb982qGiSNzp6P3NbXfUnbckq0ANeuDN0wppNwD3xQ8hwOtMNNP jwLuRjW0Jab1wVy26+mMwtVkZWLgj8c/5rtJ2OB2wJc/HT7E/JOe9wAXDm3ZTXd7mZKC kATtnMx12FaYWV0jgws7UYZWrWyxSZNjbVW6m3EaXFE+58au9jrY1kz0hkdR+tDplIDh 4kKLsAadGt7rZXfbu1QFAbgkvLbeUVLIFa1aHcdq9aDMZmqGE9m+/XC6BMp2PlomTXff Bwxw== 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=uEwG62U2ocTRAE+zcAm5Rx1np9/Wr63UQVaH+5ioR9I=; b=VwnpDz7gviu5bMT5MQ4ANzsk1SfuyKfqbWY0UeZ5ZX5TyT9b9ArFhMBnRTPXkjXoe6 xdVnCafIM4ozPsp63rXmVvKUL44hEBWMEY+uYYWLWEMJpxpxYnIZLL4wg7ktH36lFV+f Deprk4l3OKl0NYw8TtevbSxrFJxmvs/YjUjQbrIRDCH4B353GMvb0zz5me9bVgtCT1fd k+5onsCND3m/UNLeJx8Iue8HnKexYjIVmH0LixKPANRh182no98OAGAyx0WKUnj4GvSZ qNnzkf9BLNR+Jw8cCG0WR4seh2wgyJz35DPIu0AzS3jUqRT4Hx6TK6E/1olrYHP8Wi6p l6wA== X-Gm-Message-State: ACrzQf3I52dlikkKv/1pbCAfnYH4KYGpY69szDPERkuMWyZiMbXPTdXj JkrXneT6dtkvC+fuqoevOro= X-Received: by 2002:a17:902:9a41:b0:188:50c2:89cf with SMTP id x1-20020a1709029a4100b0018850c289cfmr27538355plv.34.1667856806361; Mon, 07 Nov 2022 13:33:26 -0800 (PST) Received: from youngsil.svl.corp.google.com ([2620:15c:2d4:203:5850:5958:9c77:f623]) by smtp.gmail.com with ESMTPSA id a1-20020a1709027e4100b0017f5ba1fffasm5366413pln.297.2022.11.07.13.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 13:33:26 -0800 (PST) Sender: Namhyung Kim <namhyung@gmail.com> From: Namhyung Kim <namhyung@kernel.org> To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org> Cc: Ingo Molnar <mingo@kernel.org>, Peter Zijlstra <peterz@infradead.org>, LKML <linux-kernel@vger.kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, linux-perf-users@vger.kernel.org, Kan Liang <kan.liang@linux.intel.com>, Zhengjun Xing <zhengjun.xing@linux.intel.com>, James Clark <james.clark@arm.com> Subject: [PATCH 6/9] perf stat: Do not indent headers for JSON Date: Mon, 7 Nov 2022 13:33:11 -0800 Message-Id: <20221107213314.3239159-7-namhyung@kernel.org> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog In-Reply-To: <20221107213314.3239159-1-namhyung@kernel.org> References: <20221107213314.3239159-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748874811934027774?= X-GMAIL-MSGID: =?utf-8?q?1748874811934027774?= |
Series |
perf stat: Cleanup perf stat output display (v1)
|
|
Commit Message
Namhyung Kim
Nov. 7, 2022, 9:33 p.m. UTC
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.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/stat-display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Nov 7, 2022 at 1:33 PM Namhyung Kim <namhyung@kernel.org> wrote: > > 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. > > Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Thanks, Ian > --- > 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 515fb6db3d67..25f67fb37f6d 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) { > -- > 2.38.1.431.g37b22c650d-goog >
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 515fb6db3d67..25f67fb37f6d 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) {