Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8128491rwb; Wed, 23 Nov 2022 16:06:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf6p8HAvFuhAsIPGOvjtZbSHlRWKUDyy/AwBc5FPCt0GsRTvjSWjXkpmTiSX3fHBqJYGhyKy X-Received: by 2002:a17:906:395:b0:7a0:b505:e8fb with SMTP id b21-20020a170906039500b007a0b505e8fbmr16004936eja.281.1669248418315; Wed, 23 Nov 2022 16:06:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669248418; cv=none; d=google.com; s=arc-20160816; b=HfqqyhFHHa2cMMO8MGXrTn5F+60z6AVDVQb/5w7xeW0cE/KthhCgAbNveIraXC/deA Qd9k5EkssnUjw8KPowPpQkfRpIu5PDy5a8nvaZPERBi0ZBgrFJT+NEyuAhmHvcPKZO9u ZIe7sryt7PGd6OJRB6d55tziW0DaT/X8AhN5jZNn8JcDv/iAR7pIZaU98DbkF2BhobQ0 AeYIf35UIinh87EpMp5KHdZzN9LJNNlCYW7nBTxEq7iMOQR2ykGAzg7vsqICGvdxIMZU BHVkkt2rKhyeVWQ3FajK00bjGcx2DT3DHB4+e72qzvfmDEP/XC7vpcwcS67PWdVdXd+G 83tg== 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=ayoSWu5N40Ra4iTrCvTpa/DS7Q6MrND/wB7uYtW0GPo=; b=vOjfOjStN1hD9mTFrCOZP+S1GhCWk1hFd2st7TUe8EZlTbLPuNI+83bxr8l+vv39wU o1Li3EfhfcHbnR+V03v1lKvQEwT/Si8qoGJWZXfcJPDC6nP3aAmM5xbGjRX5HcjojobU d4rxUj20dadQA5cdV4IJb8JUvuf8BtGs42kZ0E+wNJ2/kjiRRMn5trGo3awPeJfUHNRH t+SxkEiImrZkTdcWmgYfGfBwELo3lRhpPfvNp8RI2ruqhIgOj8oaq57uYTItnD2Ly1lv XLFIngrEiHNA7Sfsq2hoKdP1InwSbVoBliFCsv/mdPyYXl7MNWBcU5NOcYgNuWlqtJpL q88g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=J0gMFtUu; 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 qo14-20020a170907874e00b007897abd2d17si3256586ejc.468.2022.11.23.16.06.37; Wed, 23 Nov 2022 16:06:58 -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=J0gMFtUu; 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 S229820AbiKWXXf (ORCPT + 88 others); Wed, 23 Nov 2022 18:23:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229612AbiKWXX3 (ORCPT ); Wed, 23 Nov 2022 18:23:29 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6F4376146 for ; Wed, 23 Nov 2022 15:23:27 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id n3so15143106wrp.5 for ; Wed, 23 Nov 2022 15:23:27 -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=ayoSWu5N40Ra4iTrCvTpa/DS7Q6MrND/wB7uYtW0GPo=; b=J0gMFtUusKM7z1WD/Yw/59tPQwk1zT36/ku2ipXNQA/R59mzybS3dXGd0urmn6taAL 0/LJpF41ppRutaYM5jmDpi/71omBBeK9/MAEc7CIoFkNQYmUWqscyIN1YilCMHZc1oQ8 lddL+zkMi7Jw3LD/wkl78FzEF4EuLrMUAzId4kxkmozS7e1aC9qbErS3vYvfhK6TMS7R 3UyAVtk7O6VAbD1sBG9xQLZ4MHHbGHZSW8A9OJFOq606oYmfCoD4pBXxBu7QuK0VTIkw NAQhxGW/QmqhQrmd70DjrcKHeehlRD2VEE5vHGPJiFbyCFYhBKgFbet9/vXD6oqgXpgR tcrQ== 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=ayoSWu5N40Ra4iTrCvTpa/DS7Q6MrND/wB7uYtW0GPo=; b=4/ki0SkAE62SlByX+1JdEa6/a/wb0YueIa4gpMOljepu5bti6sV0Z8ET1W6BpscWAM KuMwNVDsEZDLQVbFjTnXY9e/mUlSxzentTJalkzpou4d+reD1HXr16VH2sE1HVrsC38Y o0pBA7sIyN0P9EPg3QdUPc5Z5hylMjl+BRd75RyjCEPXu+urCEDNmwawWyubbuxoGHLq colveNqm4fUW0AHapu4wZ/C4+MPu2rVMdqjO7LVPpHV01C+BQzwKszzd30bfywEX8bRU lxw7fbziaFHQQhVhJnleCVClPVDjexK1knibfSD7fSzwGImFHA2sTsD6/HVrzX3Ykj5d uBjg== X-Gm-Message-State: ANoB5pnXgG0BDGFCv8myiyz10rbWoiJ532sHSBDLce2aJ3tjSiUh1Ims jwNGa+onXH1bbqjXAh2WG8D/tvNkXYnzUOOEFxDb1Q== X-Received: by 2002:adf:e2c9:0:b0:241:db86:176d with SMTP id d9-20020adfe2c9000000b00241db86176dmr8947881wrj.40.1669245806183; Wed, 23 Nov 2022 15:23:26 -0800 (PST) MIME-Version: 1.0 References: <20221123180208.2068936-1-namhyung@kernel.org> <20221123180208.2068936-6-namhyung@kernel.org> In-Reply-To: <20221123180208.2068936-6-namhyung@kernel.org> From: Ian Rogers Date: Wed, 23 Nov 2022 15:23:13 -0800 Message-ID: Subject: Re: [PATCH 05/15] perf stat: Remove prefix argument in print_metric_headers() 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 , Athira Jajeev 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 Wed, Nov 23, 2022 at 10:02 AM Namhyung Kim wrote: > > It always passes a whitespace to the function, thus we can just add it to the > function body. Furthermore, it's only used in the normal output mode. > > Well, actually CSV used it but it doesn't need to since we don't care about the > indentation or alignment in the CSV output. > > Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Thanks, Ian > --- > tools/perf/util/stat-display.c | 26 ++++++++++---------------- > 1 file changed, 10 insertions(+), 16 deletions(-) > > diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c > index 744b7a40f59a..deed6ccf072f 100644 > --- a/tools/perf/util/stat-display.c > +++ b/tools/perf/util/stat-display.c > @@ -996,10 +996,9 @@ static void print_no_aggr_metric(struct perf_stat_config *config, > } > > static void print_metric_headers_std(struct perf_stat_config *config, > - const char *prefix, bool no_indent) > + bool no_indent) > { > - if (prefix) > - fprintf(config->output, "%s", prefix); > + fputc(' ', config->output); > > if (!no_indent) { > int len = aggr_header_lens[config->aggr_mode]; > @@ -1012,11 +1011,8 @@ static void print_metric_headers_std(struct perf_stat_config *config, > } > > static void print_metric_headers_csv(struct perf_stat_config *config, > - const char *prefix, > bool no_indent __maybe_unused) > { > - if (prefix) > - fprintf(config->output, "%s", prefix); > if (config->interval) > fputs("time,", config->output); > if (!config->iostat_run) > @@ -1024,7 +1020,6 @@ static void print_metric_headers_csv(struct perf_stat_config *config, > } > > static void print_metric_headers_json(struct perf_stat_config *config, > - const char *prefix __maybe_unused, > bool no_indent __maybe_unused) > { > if (config->interval) > @@ -1032,8 +1027,7 @@ static void print_metric_headers_json(struct perf_stat_config *config, > } > > static void print_metric_headers(struct perf_stat_config *config, > - struct evlist *evlist, > - const char *prefix, bool no_indent) > + struct evlist *evlist, bool no_indent) > { > struct evsel *counter; > struct outstate os = { > @@ -1047,11 +1041,11 @@ static void print_metric_headers(struct perf_stat_config *config, > }; > > if (config->json_output) > - print_metric_headers_json(config, prefix, no_indent); > + print_metric_headers_json(config, no_indent); > else if (config->csv_output) > - print_metric_headers_csv(config, prefix, no_indent); > + print_metric_headers_csv(config, no_indent); > else > - print_metric_headers_std(config, prefix, no_indent); > + print_metric_headers_std(config, no_indent); > > if (config->iostat_run) > iostat_print_header_prefix(config); > @@ -1132,7 +1126,7 @@ static void print_header_interval_std(struct perf_stat_config *config, > } > > if (config->metric_only) > - print_metric_headers(config, evlist, " ", true); > + print_metric_headers(config, evlist, true); > else > fprintf(output, " %*s %*s events\n", > COUNTS_LEN, "counts", config->unit_width, "unit"); > @@ -1168,7 +1162,7 @@ static void print_header_std(struct perf_stat_config *config, > fprintf(output, ":\n\n"); > > if (config->metric_only) > - print_metric_headers(config, evlist, " ", false); > + print_metric_headers(config, evlist, false); > } > > static void print_header_csv(struct perf_stat_config *config, > @@ -1178,7 +1172,7 @@ static void print_header_csv(struct perf_stat_config *config, > const char **argv __maybe_unused) > { > if (config->metric_only) > - print_metric_headers(config, evlist, " ", true); > + print_metric_headers(config, evlist, true); > } > static void print_header_json(struct perf_stat_config *config, > struct target *_target __maybe_unused, > @@ -1187,7 +1181,7 @@ static void print_header_json(struct perf_stat_config *config, > const char **argv __maybe_unused) > { > if (config->metric_only) > - print_metric_headers(config, evlist, " ", true); > + print_metric_headers(config, evlist, true); > } > > static void print_header(struct perf_stat_config *config, > -- > 2.38.1.584.g0f3c55d4c2-goog >