Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp69778imm; Wed, 5 Sep 2018 15:09:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdatrQbVa0nf8zbEqqzqyyywbsVN8hVVStsggTq/JjtS4fk6yIdeuqSHZAX1HVeY61m3if9G X-Received: by 2002:a62:ac12:: with SMTP id v18-v6mr43122450pfe.126.1536185372279; Wed, 05 Sep 2018 15:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185372; cv=none; d=google.com; s=arc-20160816; b=SbDyToFcVzrRzMw5Ovolkl2mLVvYXqJ7jsSaUHHcQdcBOiCTMFAhR07qelenhrcTQn 0Wl9cqpz4jl1FaqgoL5xp/yNDhPHPaMNj+5/fomn2bRJWpFxkk+kAbBboEwe91WGsglD PGzkOLTvCl3EExIk/b6RUT3q7Z/WsqJlK66zKkcy/kuSZuWGuFZm247yVDxByQaPvG83 ESGyqxmoZ2DCqGsIZgK+ttAc4EoY8CVI7FcW0UOyyVFMIo9GB/grpI/6j5u1sC8e9Og2 gg8hkCOho0xJnLl3HF1ziQtxrcUzZnzB8VUc4N9x3KwC9LsOuDIvCIkbuczUa4k16lQg nVZg== 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=cd/o8USUCaptY3bj9fLm6c/7jVAnPgt+MTy+NiiRYX4=; b=IbT5x6A4ZzcCHXBVs3ru1Ylc+Ny/eGyE1UfCHR0GEI8fJbeA8/uhy+gkrPsDydYNlm /xZVN7LiKiA5kRd6yWhtgRK8KLonYSkvOP40543Frs4tjt5jS7pQpMTzylP0SVyoTR6s 7YZ7EPxPm+B3sv8ukZrDmTGLsq1cDjrfnXxSt3VHN0n3pi8CJ/PNXODHM41eK4eonmvl w5v8Neg+hlJ5sIc+gTMuCs0nRy6qcaw3dMGKrrMWBFQ14fjHzs3ppTJowlQKCZhBIhvX 8Vp+6WWzCwShehQ3qLQKcEjLCq/8Gb8ybAqZkYm9uyQgSz2FIw1mv7YpPsoEFwSmnRaE 2uhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AzY1Tw87; 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 f16-v6si3019365pgv.75.2018.09.05.15.09.17; Wed, 05 Sep 2018 15:09:32 -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=AzY1Tw87; 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 S1728851AbeIFCjd (ORCPT + 99 others); Wed, 5 Sep 2018 22:39:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:54364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727593AbeIFCjc (ORCPT ); Wed, 5 Sep 2018 22:39:32 -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 E783720867; Wed, 5 Sep 2018 22:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185240; bh=X0mFrSv378Itl94i53kJsc68tBIXrOJUJlbMsrOfTxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AzY1Tw87YNNLAs7UpQh3QH+6pY2cKKk6xqQr/Gg2cCUB5A4oEXuOKhBmoFp0tcbVd FwNV/PO43fHgLB/3MeCUKdrEVzRMlrAtSLG7RzwDMIgmbySfF70OTLFOWcDI71YqXo SUw5fgfKOys4SaLqzRBXLIxb3Pcco8iy/8H5RpkY= 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 54/77] perf stat: Pass 'struct perf_stat_config' to first_shadow_cpu() Date: Wed, 5 Sep 2018 19:04:17 -0300 Message-Id: <20180905220440.20256-55-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 Pass a 'struct perf_stat_config' arg to first_shadow_cpu(), so that the function does not depend on the 'perf stat' command object local 'stat_config' variable and can then be moved out. 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-30-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index e96cef526ef0..f5ac6545af34 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -919,17 +919,18 @@ static void print_metric_header(struct perf_stat_config *config, fprintf(os->fh, "%*s ", config->metric_only_len, unit); } -static int first_shadow_cpu(struct perf_evsel *evsel, int id) +static int first_shadow_cpu(struct perf_stat_config *config, + struct perf_evsel *evsel, int id) { int i; if (!aggr_get_id) return 0; - if (stat_config.aggr_mode == AGGR_NONE) + if (config->aggr_mode == AGGR_NONE) return id; - if (stat_config.aggr_mode == AGGR_GLOBAL) + if (config->aggr_mode == AGGR_GLOBAL) return 0; for (i = 0; i < perf_evsel__nr_cpus(evsel); i++) { @@ -1090,7 +1091,7 @@ static void printout(struct perf_stat_config *config, int id, int nr, } perf_stat__print_shadow_stats(config, counter, uval, - first_shadow_cpu(counter, id), + first_shadow_cpu(config, counter, id), &out, &metric_events, st); if (!config->csv_output && !config->metric_only) { print_noise(config, counter, noise); @@ -1098,7 +1099,7 @@ static void printout(struct perf_stat_config *config, int id, int nr, } } -static void aggr_update_shadow(void) +static void aggr_update_shadow(struct perf_stat_config *config) { int cpu, s2, id, s; u64 val; @@ -1115,7 +1116,7 @@ static void aggr_update_shadow(void) val += perf_counts(counter->counts, cpu, 0)->val; } perf_stat__update_shadow_stats(counter, val, - first_shadow_cpu(counter, id), + first_shadow_cpu(config, counter, id), &rt_stat); } } @@ -1237,7 +1238,7 @@ static void print_aggr(struct perf_stat_config *config, if (!(aggr_map || aggr_get_id)) return; - aggr_update_shadow(); + aggr_update_shadow(config); /* * With metric_only everything is on a single line. -- 2.14.4