Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1383207imm; Wed, 6 Jun 2018 15:18:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJy4wai9fXK3XaUXrWXITEqrkj5/Wg8hjuq3xj9LQRP4l4aECFkzRbSTkVOM+JttApXd33I X-Received: by 2002:a63:7459:: with SMTP id e25-v6mr3863074pgn.186.1528323529527; Wed, 06 Jun 2018 15:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528323529; cv=none; d=google.com; s=arc-20160816; b=AzmEhqrjU8AJGynCOccgGFPGCRwaycDIhOUmOqRry1LQ6qD4AARNy0IAE7brq0lBUJ RuDpxNHXe/fwEUtiBie3/DELCKn+JobHxwQbpn5Z2GPG75yjhtWqcufUBhDSP0czvCJc g+Va/RJi7X9tcjpsBkEjfTEspYRwc7PgNUPYAl8aQjNpWhdtpTUpGL1GsqwjQYvNclrl TJcsh9P+SoFW3GyJre7GcMOuG3PeR15MTB8QWMUB8wSqMxDqgG6NtQaZ2EEooatXKk18 srUZtlBOvpvPXqGC4FYs7bj7Nald1jcf3JzPl5YH0V6wWUJwlNMdkEdl6L1QxkfRCr0D 6hfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=8cDvEie7Xd2zLwf99aJ6FvTv2Q/ir2zzucyrOnH2C7M=; b=ciJ30cumMae7LnI//ONnsTam5hTCeyk5KHaPEc2HN49igmKnJbu6u1MCWq7xLv3S1L uYNJbA769WPOm5Ne3Sr/ITc/ghhsSxLynRcxHALWU2tIIbhSIXpQMYB2KAMKyjTNKBOV UhWQzV+Iyq/ggDuGLGSm6US6OR5NfeX9SVFzlNW/F5VkuX5Gb7jLf+IvYsJ2jCGRAV3f Q/fbJdh58EdyQqZbgbs7Vc2HVMIn0M/eZYjAy+B7rN56RZq95lmGhrXXBI5kezVjWQyD dlpdf+3wQj/shSaVMpClLii4HJGplfGZswg/NTZ6x+oTZ8uGDwzODnCbeXCE06zYnGmW vHkg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10-v6si28996917pga.219.2018.06.06.15.18.35; Wed, 06 Jun 2018 15:18:49 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752649AbeFFWPj (ORCPT + 99 others); Wed, 6 Jun 2018 18:15:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55830 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752282AbeFFWPg (ORCPT ); Wed, 6 Jun 2018 18:15:36 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6EC7B8151D42; Wed, 6 Jun 2018 22:15:35 +0000 (UTC) Received: from krava.redhat.com (ovpn-204-89.brq.redhat.com [10.40.204.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8191E2026DEF; Wed, 6 Jun 2018 22:15:33 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo , Peter Zijlstra Cc: lkml , Ingo Molnar , Namhyung Kim , David Ahern , Alexander Shishkin , Stephane Eranian , Milian Wolff , Andi Kleen , Frederic Weisbecker Subject: [PATCH 06/10] perf stat: Allow to specify specific metric column len Date: Thu, 7 Jun 2018 00:15:09 +0200 Message-Id: <20180606221513.11302-7-jolsa@kernel.org> In-Reply-To: <20180606221513.11302-1-jolsa@kernel.org> References: <20180606221513.11302-1-jolsa@kernel.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 06 Jun 2018 22:15:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 06 Jun 2018 22:15:35 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@kernel.org' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Following change will introduce new metrics, that don't need such wide hard coded spacing. Switching METRIC_ONLY_LEN macro usage with metric_only_len variable. Link: http://lkml.kernel.org/n/tip-bh0ke4fh2ygpj3yowna7o1di@git.kernel.org Signed-off-by: Jiri Olsa --- 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 4e7bae4c98d2..a8f93885763a 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) -- 2.13.6