Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1556931imm; Wed, 13 Jun 2018 23:25:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLb7u5e0TpCWpxbIdwJjZVwxH1s8kygdOUY8PnTYBlooA715jHNCDapS8KgPX6UC1vnWHAs X-Received: by 2002:a17:902:292b:: with SMTP id g40-v6mr1505354plb.273.1528957542472; Wed, 13 Jun 2018 23:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528957542; cv=none; d=google.com; s=arc-20160816; b=IsoDSk1frLIBg17qdTeMSOrGh/fpD7E9ZVmMBaE3tf2r77WtUo/83T9Ng6+YPKHmJ/ xu8syIw6XKpdVlwo+Lc9COqmgOAra2sLoCWodgy54JIC2WrfXtV/31w8tGHkvVulWiQZ CmsJJe6wlkGbOpaem6sQ6t+4d0DPzokyw323igWruGPeOeO6bDUZu0ZbgOgYkCUBOI83 V5bpRmsiRZwbbd0F7Fd06K9y2HyTHC8dCh+Yx7Wq684jo2eUq5YMoIQFj9XUQB/q4o/C eMHHVBvehTcoVyxsPkIogynOLOKQcQzNl85iksaW1kygnIcWiMdr15Ugft3/7AmULPP2 9azQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=YHmdCVluL2nHFOdHFQX+4ikdS1C8Hx9rAK5kaawrDB8=; b=XDUnKuTIJEfhqUKDHn25RwEZzW7AGqpJo/hl/yWiT+dc1NfBhkDz/sWxTRoHbYsvbp sqSe586eYuvtmPnaHnVdgXuZsg1THDwysKJm1xvTRIvDxkLbsgr+KhMZwJ3fT7mOIaAA T/oJMJGwevARBwTbK5kUtwKrt2tA29y55Vdm4r8VF9kQR9T1S6++Z7jZyKIwwyNV487m z9siZlGnw1HTFT8ssw1nxqMFBuq3wduzMkjOYCbSd5PJaE5UJl3hEwNJI+CR1utQS7xt WpzOb5TeZrJuw95/VldgJWARcRwM0cmyxG1Qaha1PRYHzNXnrOHR61Ulq3NtCpnZxNEP j/oQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3-v6si3969246pgf.191.2018.06.13.23.25.28; Wed, 13 Jun 2018 23:25:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754650AbeFNGXu (ORCPT + 99 others); Thu, 14 Jun 2018 02:23:50 -0400 Received: from terminus.zytor.com ([198.137.202.136]:38987 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752892AbeFNGXr (ORCPT ); Thu, 14 Jun 2018 02:23:47 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5E6NJOZ763861 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 13 Jun 2018 23:23:19 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5E6NJVK763858; Wed, 13 Jun 2018 23:23:19 -0700 Date: Wed, 13 Jun 2018 23:23:19 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Jiri Olsa Message-ID: Cc: tglx@linutronix.de, peterz@infradead.org, hpa@zytor.com, alexander.shishkin@linux.intel.com, milian.wolff@kdab.com, andi@firstfloor.org, acme@redhat.com, linux-kernel@vger.kernel.org, eranian@google.com, jolsa@kernel.org, frederic@kernel.org, namhyung@kernel.org, mingo@kernel.org, dsahern@gmail.com Reply-To: linux-kernel@vger.kernel.org, frederic@kernel.org, jolsa@kernel.org, eranian@google.com, acme@redhat.com, dsahern@gmail.com, namhyung@kernel.org, mingo@kernel.org, milian.wolff@kdab.com, andi@firstfloor.org, hpa@zytor.com, alexander.shishkin@linux.intel.com, tglx@linutronix.de, peterz@infradead.org In-Reply-To: <20180606221513.11302-7-jolsa@kernel.org> References: <20180606221513.11302-7-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf stat: Allow to specify specific metric column len Git-Commit-ID: c1a1f5d9da800dc715d8c1d8a9692c63c70c2955 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c1a1f5d9da800dc715d8c1d8a9692c63c70c2955 Gitweb: https://git.kernel.org/tip/c1a1f5d9da800dc715d8c1d8a9692c63c70c2955 Author: Jiri Olsa AuthorDate: Thu, 7 Jun 2018 00:15:09 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 7 Jun 2018 16:01:44 -0300 perf stat: Allow to specify specific metric column len The following change will introduce new metrics, that doesn't need such wide hard coded spacing. Switch METRIC_ONLY_LEN macro usage with metric_only_len variable. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: David Ahern Cc: Frederic Weisbecker Cc: Milian Wolff Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/20180606221513.11302-7-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 8f3fdc052728..3fc1f5286d50 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -145,6 +145,8 @@ static struct target target = { typedef int (*aggr_get_id_t)(struct cpu_map *m, int cpu); +#define METRIC_ONLY_LEN 20 + static int run_count = 1; static bool no_inherit = false; static volatile pid_t child_pid = -1; @@ -182,6 +184,7 @@ static int print_mixed_hw_group_error; static u64 *walltime_run; static bool ru_display = false; static struct rusage ru_data; +static unsigned int metric_only_len = METRIC_ONLY_LEN; struct perf_stat { bool record; @@ -969,8 +972,6 @@ static void print_metric_csv(void *ctx, fprintf(out, "%s%s%s%s", csv_sep, vals, csv_sep, unit); } -#define METRIC_ONLY_LEN 20 - /* Filter out some columns that don't work well in metrics only mode */ static bool valid_only_metric(const char *unit) @@ -1002,7 +1003,7 @@ static void print_metric_only(void *ctx, const char *color, const char *fmt, struct outstate *os = ctx; FILE *out = os->fh; char buf[1024], str[1024]; - unsigned mlen = METRIC_ONLY_LEN; + unsigned mlen = metric_only_len; if (!valid_only_metric(unit)) return; @@ -1054,7 +1055,7 @@ static void print_metric_header(void *ctx, const char *color __maybe_unused, if (csv_output) fprintf(os->fh, "%s%s", unit, csv_sep); else - fprintf(os->fh, "%*s ", METRIC_ONLY_LEN, unit); + fprintf(os->fh, "%*s ", metric_only_len, unit); } static void nsec_printout(int id, int nr, struct perf_evsel *evsel, double avg)