Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp69660imm; Wed, 5 Sep 2018 15:09:24 -0700 (PDT) X-Google-Smtp-Source: ANB0VdblsdA4ir/OLPupgRJibmMHiRgyjgnbcsNtrb7Yth9vXn+s7PLUJg1IkIsl/h1HHJC69Uyh X-Received: by 2002:a63:a35f:: with SMTP id v31-v6mr39013180pgn.261.1536185364470; Wed, 05 Sep 2018 15:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185364; cv=none; d=google.com; s=arc-20160816; b=LRt54AFItSkH6EV41hSlCcnOT85rSWr+miKnhm82JHu535cA2Xbd0PfVhahX2ZeedY eKJnP7ECSF/AlzyaPXQMUTjuajnHVTIOKvzMeaEHmqmFdCq70L1kfkcxdIbp/iloz2rL jdK8QeMNAmmGlt2ojdi/n8DgeQ2MHAIXf2xunQ7IfWiJ2B5euFj0vdochJSL+02B1LvU VnSUkT7NxqlbYe9PM7NmuKlvMDmn4in7AEZoXaNVKmgWpqNYqcmOS+wr6txOHGh9jQSH TYzBZDszQL0UbvOfTCrjW3Ue4H/q037c+xURaAtNOcyobVSi9hBBv3lqL/BMGvf2rLK4 2k+w== 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=ib64A27574jhpqDc07QtwlWX10JB5T/gHiLBON40/EY=; b=YyOa8qcZLWqUjDnL3XruGJht7YQftKdXxcl9OHvBzfe1tZGGXNYs+9u1Zfkarh8k7y DiPlPpN7vefcrcIyrRz5fSncbY5ID8nhIx6Kl6BkduZjnhwAJuAGUEpCV7mYXTfiDozf L7O3X2bq6vqto/NUhIHAQStC/zqHcEuI6zihDGlp4hbqvepRzdhLzkoJHZXwgN7dqpSS Mbc9p4elsjvbkkaTQGxRkGrZDgwAC9DRCYWsKN6Qf8nd/PDp4J8KOHpeq088xgBV8Mik icIjAxga14pOEs8MahvW0ue5Rn9J/EIfUpvc7QK5ooSdbTLDaKcfdbaPtmFIHD6HQAZg etvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WbCL4mbh; 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 w8-v6si3262438plk.222.2018.09.05.15.09.08; Wed, 05 Sep 2018 15:09:24 -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=WbCL4mbh; 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 S1728795AbeIFCjW (ORCPT + 99 others); Wed, 5 Sep 2018 22:39:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:54114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727593AbeIFCjW (ORCPT ); Wed, 5 Sep 2018 22:39:22 -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 242392083E; Wed, 5 Sep 2018 22:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185229; bh=nVCr66G5bX9RPmTM7NPz/L4TiXS/PSoe5kubzQOkRyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbCL4mbhoFXKeqOjY3ZyffP2hVGzEMOqSD6xILXapshPmCHLos6qaTk5B/Kp2zOuY t7ntdYvJ8TRB/XLWlNB/Uq2q0qvHheRv+lbB2W4bzYWK13uY+C2ajKaSW7O2bKSPZ4 TEvpSJuZbNMSOKf4uoNggr9kB+tNNczAij8I00w4= 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 50/77] perf stat: Pass 'evlist' argument to print functions Date: Wed, 5 Sep 2018 19:04:13 -0300 Message-Id: <20180905220440.20256-51-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 Add 'evlist' argument to print functions to get rid of the global 'evsel_list' variable dependency. 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-26-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 528f85146b59..46181ac492c5 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1222,6 +1222,7 @@ static void aggr_cb(struct perf_evsel *counter, void *data, bool first) } static void print_aggr(struct perf_stat_config *config, + struct perf_evlist *evlist, char *prefix) { bool metric_only = config->metric_only; @@ -1248,7 +1249,7 @@ static void print_aggr(struct perf_stat_config *config, ad.id = id = aggr_map->map[s]; first = true; - evlist__for_each_entry(evsel_list, counter) { + evlist__for_each_entry(evlist, counter) { if (is_duration_time(counter)) continue; @@ -1449,6 +1450,7 @@ static void print_counter(struct perf_stat_config *config, } static void print_no_aggr_metric(struct perf_stat_config *config, + struct perf_evlist *evlist, char *prefix) { int cpu; @@ -1457,13 +1459,13 @@ static void print_no_aggr_metric(struct perf_stat_config *config, u64 ena, run, val; double uval; - nrcpus = evsel_list->cpus->nr; + nrcpus = evlist->cpus->nr; for (cpu = 0; cpu < nrcpus; cpu++) { bool first = true; if (prefix) fputs(prefix, config->output); - evlist__for_each_entry(evsel_list, counter) { + evlist__for_each_entry(evlist, counter) { if (is_duration_time(counter)) continue; if (first) { @@ -1499,6 +1501,7 @@ static const char *aggr_header_csv[] = { }; static void print_metric_headers(struct perf_stat_config *config, + struct perf_evlist *evlist, const char *prefix, bool no_indent) { struct perf_stat_output_ctx out; @@ -1520,7 +1523,7 @@ static void print_metric_headers(struct perf_stat_config *config, } /* Print metrics headers only */ - evlist__for_each_entry(evsel_list, counter) { + evlist__for_each_entry(evlist, counter) { if (is_duration_time(counter)) continue; os.evsel = counter; @@ -1539,6 +1542,7 @@ static void print_metric_headers(struct perf_stat_config *config, } static void print_interval(struct perf_stat_config *config, + struct perf_evlist *evlist, char *prefix, struct timespec *ts) { bool metric_only = config->metric_only; @@ -1584,7 +1588,7 @@ static void print_interval(struct perf_stat_config *config, } if ((num_print_interval == 0 || config->interval_clear) && metric_only) - print_metric_headers(config, " ", true); + print_metric_headers(config, evlist, " ", true); if (++num_print_interval == 25) num_print_interval = 0; } @@ -1727,7 +1731,7 @@ perf_evlist__print_counters(struct perf_evlist *evlist, char buf[64], *prefix = NULL; if (interval) - print_interval(config, prefix = buf, ts); + print_interval(config, evlist, prefix = buf, ts); else print_header(config, _target, argc, argv); @@ -1735,7 +1739,7 @@ perf_evlist__print_counters(struct perf_evlist *evlist, static int num_print_iv; if (num_print_iv == 0 && !interval) - print_metric_headers(config, prefix, false); + print_metric_headers(config, evlist, prefix, false); if (num_print_iv++ == 25) num_print_iv = 0; if (config->aggr_mode == AGGR_GLOBAL && prefix) @@ -1745,7 +1749,7 @@ perf_evlist__print_counters(struct perf_evlist *evlist, switch (config->aggr_mode) { case AGGR_CORE: case AGGR_SOCKET: - print_aggr(config, prefix); + print_aggr(config, evlist, prefix); break; case AGGR_THREAD: evlist__for_each_entry(evlist, counter) { @@ -1765,7 +1769,7 @@ perf_evlist__print_counters(struct perf_evlist *evlist, break; case AGGR_NONE: if (metric_only) - print_no_aggr_metric(config, prefix); + print_no_aggr_metric(config, evlist, prefix); else { evlist__for_each_entry(evlist, counter) { if (is_duration_time(counter)) -- 2.14.4