Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5874255rwb; Mon, 14 Nov 2022 10:38:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf75lQv2WCeu3yppaM2ZSJ90xU/+c0ZUhIfi8t/1NmIqtq97UU6iz0rjEgZ1+Ontd5AZlAbW X-Received: by 2002:a17:906:d115:b0:79e:9aea:7b60 with SMTP id b21-20020a170906d11500b0079e9aea7b60mr11487592ejz.444.1668451116669; Mon, 14 Nov 2022 10:38:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668451116; cv=none; d=google.com; s=arc-20160816; b=QYLS7woc6pcSEuGAzLnheiSjJ1X1h9P/nFUE7qu8dWk6Z/QaQuGrBNf8CF3NMKftQN E2M7lKJ9shEo9wDFGL/ILuZ6S48jOTNwcRj2Uf5IDUSzEkWbfM9NlZhJtohvS94Gqckw 7MADX6p+Fd7vNwQSjBLjFEYFO+13LofC+9JCxDc0HPF3eKzygR/xC3uNnZLUEy/QnVhi hJfnSh119/kkPg7ubyIhcCYsKGeYccZiS+maIxivmggIVJjzt1r4ys66LxjNek8vLrhX fAktA6EEZo+ARbRUqI73D+EiDaybJks4/feaikOIpXFwzmv1ugQdXZlqiC9Zcbj/Osy8 EKGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1XipPx7HJpL1+jctec2qyggfKC2GCddSF+AfxJOo69s=; b=zSQw2NXSZhufmIxoW37S3kAXvKNBMbD/iPrAYFq2YJq6yAYprGQrONtAbOJWStUaQy nXFpltHlS2XKEy2nLaAiOXMBY738helpaFJ6okM7ckIHHICqDVQJWSQRmx8fbwx8BnRs liG4/cw/TYKbePIin4bfDQc1nUfdHF/yCkQo9hw9DIV5DL0vQu/2ajLSdn2fPcMlBxr5 2QFa4d1biUWxYBiBzh8Vy5F6QJJFEVfymOJ7FGA4CD6yn3hqCEWwAebYpEI9l9j9OkNn XmryG1fDlh/8jWOR+ZHwQr0SPAcTUmQ8ehRtUUqkgvHQAt1eoc3B5N5sm+fHub032GWA zuow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VEg6wNwD; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020aa7c503000000b004488842d88esi6748719edq.13.2022.11.14.10.38.13; Mon, 14 Nov 2022 10:38:36 -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=@google.com header.s=20210112 header.b=VEg6wNwD; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236993AbiKNSVI (ORCPT + 89 others); Mon, 14 Nov 2022 13:21:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236715AbiKNSU6 (ORCPT ); Mon, 14 Nov 2022 13:20:58 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC546303D1 for ; Mon, 14 Nov 2022 10:20:51 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id o4so19715724wrq.6 for ; Mon, 14 Nov 2022 10:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1XipPx7HJpL1+jctec2qyggfKC2GCddSF+AfxJOo69s=; b=VEg6wNwDP3oW6fuxz9ug8JX3xb83qFjA0uDUpNJxZLXFOzUMHzI7X2l6qqTPHes+Z6 6BsCiRBg/LA/0J6WCbYEoBcy2JedfAj5q64amjnQlpKWEVuKm6tTwbezhlH5vl84ACns UcmHYaaU8OnQQ+gZ3M7yDA6cbx0x9pM1SjsAUK/5xqsglu0ucC1uUCzD1w5zmKh/fvZg AoCfaHVH+alqQoReRiZ2nUT2OYQ22UId7mhWtP7NfTVw3bOEgYuhDciR0McsTgGlLRci v1yDgR7eTheaGMzy7YW1weOsVI3kyEGo2yQ+1+3t47feyvi6eKn09sU/f5lRRdAdYUtF f2Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1XipPx7HJpL1+jctec2qyggfKC2GCddSF+AfxJOo69s=; b=PAPTaNPAVVZhi/GhD15UXaA7SJ9DL0+PL1hIJZ9Nc03plMR2iq3+fyXKhU2oeLmu7M Yadu1+ilSVN6xI0bUzhLK1hbb9Uro2Sdto13GSUJwFWNvXb5lai06S1SqLaPhGe0nQp7 qSkAL9YpzNIWaPRODsoMB1Br2vTUnuFy9m0sPhXTR/uGUbXYrpYcjpAdeKZUu8ji6S6P mjgmi5I3XTknMaSqqNSA1ZjfUgWdg+4wCwTt3HSe01iA5oyaJBL8hGDp/xwMi9gfRAl6 ZIw3TuvNAMLKWErcwkbQcqJmeeI/SEYP9EehiyF1+ltY6gg0sx50apl0js0whDi09hNU YxNg== X-Gm-Message-State: ANoB5pn8uMPvME88g8mheaBldiuL9VKEqRakUb35ypKxnGCI9iJ6AYEp PfRw1dIzoOY9+uteex17ylTSXWd4aO+34CPr8tMGkA== X-Received: by 2002:a05:6000:1241:b0:236:d8f8:b87d with SMTP id j1-20020a056000124100b00236d8f8b87dmr8165981wrx.343.1668450050179; Mon, 14 Nov 2022 10:20:50 -0800 (PST) MIME-Version: 1.0 References: <20221112032244.1077370-1-namhyung@kernel.org> <20221112032244.1077370-11-namhyung@kernel.org> In-Reply-To: <20221112032244.1077370-11-namhyung@kernel.org> From: Ian Rogers Date: Mon, 14 Nov 2022 10:20:38 -0800 Message-ID: Subject: Re: [PATCH 10/11] perf stat: Fix summary output in CSV with --metric-only To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Ingo Molnar , Peter Zijlstra , LKML , Adrian Hunter , linux-perf-users@vger.kernel.org, Kan Liang , Zhengjun Xing , James Clark Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 On Fri, Nov 11, 2022 at 7:23 PM Namhyung Kim wrote: > > 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 Thanks, Ian > --- > 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) { > -- > 2.38.1.493.g58b659f92b-goog >