Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp70173imm; Wed, 5 Sep 2018 15:09:57 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYNhDYwj47uXako+LeMfPJ2e7g6THYcsKeAXkYTF/nUPj6K3Zeg5XSASduJXPrflLTJswNs X-Received: by 2002:a65:5581:: with SMTP id j1-v6mr38129121pgs.203.1536185397874; Wed, 05 Sep 2018 15:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185397; cv=none; d=google.com; s=arc-20160816; b=F979ei5HlsoFjEe55ej/gNYrAnFg+0vLieOgvqs15cXv2/tOc1PsO9doc/h9CnjsMU VkTz8AqExgFOc99BpLYMoA/YF1WNsw1Huk4rfVMbfOLY41yNaDux/ludzKPAZ8fskoEj ++rYVJzCTbND/fA49I0FeIC2LC29Ex31hrPnW5HpFC+/OHucaU+8dHNfZpexmu3d9Hjh THunGvu6XBT5dDbvYm2Sr4GSSTLrNtI8ZUPXEtIA4zA8Z8tuD7qmps/NhbuJYlzBIUC9 YCDJKcdVLIGjm7+d2bEvOG/6rXktYemXxAFNZ82Oxl4IGbSGiI/I7Vtx9JT3fMhozzcU Lppw== 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:dkim-signature; bh=d8z5UhzbJ5Xj+szW9GwWKqZDFPCyw+7mBesZlVh5Z9Y=; b=fWbJDSsM/bkrpnMle9/0veKJH6IMawDjMxDHCSfDeYvpsxsXHGHKVcgXdXYA+Qg3nK 4Sdns3bx/phLPw7/Ex090hkfIsK1UACuvNC2V7jtS+MonzY6Mu7TqXGJ2XCiqs6lL5b5 d46E5CWXbivvGuZ63/QaMTZ7I4szs61Cl3RIM3qzr19EC8SqY4LggLQbklDeNkkNjfx8 e5vmVnsPLxAw5ll3trkMFR6w0FZz7pDLqMbLEPh+BLomz8s37ehJEyEpmcpHyqBlRDjx 6R2AC8De6gv0mvU1oTOGJ5a0nmiv8lpDjg+uzhj7WfOinJ6Y3XdrCw2Uhf4IcW52rqb2 PDZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=slljtvGY; 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=pass (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 e6-v6si4010012pln.265.2018.09.05.15.09.43; Wed, 05 Sep 2018 15:09:57 -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; dkim=pass header.i=@kernel.org header.s=default header.b=slljtvGY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728985AbeIFCj7 (ORCPT + 99 others); Wed, 5 Sep 2018 22:39:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:54936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727586AbeIFCj6 (ORCPT ); Wed, 5 Sep 2018 22:39:58 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E1F6F20652; Wed, 5 Sep 2018 22:07:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185266; bh=aOc5mfcmAt7Hf5ZpOiI4YgAp8forDuf5+ZWE6dDsFz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=slljtvGYObBYbReSP7lOKEh8V8zFUakYEZyq5BXwsA1/+hhh98WDL8LTFlX/1ELac Nht8V8hCWeQq/jPIn3/QsI/Jzk8r7tmlj3p+szt7X5ydPQjsZxEcqXfPIZkz3MbKTY NSUbqtwq6fqbDfOA0O+5Vioid/IkKt3RCY3cBmAc= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Jiri Olsa , Alexander Shishkin , Andi Kleen , David Ahern , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 63/77] perf stat: Move 'big_num' data to 'struct perf_stat_config' Date: Wed, 5 Sep 2018 19:04:26 -0300 Message-Id: <20180905220440.20256-64-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180905220440.20256-1-acme@kernel.org> References: <20180905220440.20256-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Olsa Move the static variable 'big_num' to 'struct perf_stat_config', so that it can be passed around and used outside 'perf stat' command. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180830063252.23729-39-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 8 ++++---- tools/perf/util/stat.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 445673f688de..8ca85017a973 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -151,7 +151,6 @@ static bool transaction_run; static bool topdown_run = false; static bool smi_cost = false; static bool smi_reset = false; -static bool big_num = true; static int big_num_opt = -1; static bool group = false; static const char *pre_cmd = NULL; @@ -192,6 +191,7 @@ static struct perf_stat_config stat_config = { .run_count = 1, .metric_only_len = METRIC_ONLY_LEN, .walltime_nsecs_stats = &walltime_nsecs_stats, + .big_num = true, }; static bool is_duration_time(struct perf_evsel *evsel) @@ -945,7 +945,7 @@ static void abs_printout(struct perf_stat_config *config, if (config->csv_output) { fmt = floor(sc) != sc ? "%.2f%s" : "%.0f%s"; } else { - if (big_num) + if (config->big_num) fmt = floor(sc) != sc ? "%'18.2f%s" : "%'18.0f%s"; else fmt = floor(sc) != sc ? "%18.2f%s" : "%18.0f%s"; @@ -2847,9 +2847,9 @@ int cmd_stat(int argc, const char **argv) parse_options_usage(NULL, stat_options, "x", 1); goto out; } else /* Nope, so disable big number formatting */ - big_num = false; + stat_config.big_num = false; } else if (big_num_opt == 0) /* User passed --no-big-num */ - big_num = false; + stat_config.big_num = false; setup_system_wide(argc); diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index be202b066e62..843672214cca 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -103,6 +103,7 @@ struct perf_stat_config { bool metric_only; bool null_run; bool ru_display; + bool big_num; FILE *output; unsigned int interval; unsigned int timeout; -- 2.14.4