Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp70188imm; Wed, 5 Sep 2018 15:09:58 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ5b8yDpnqCN3z8SqyEKLF7MqGFXiOJ8Btuy1XbJk5Nv+H0I6sV/Iw7bJqmeEzqpNdqcBKU X-Received: by 2002:a63:1c61:: with SMTP id c33-v6mr25636782pgm.109.1536185398426; Wed, 05 Sep 2018 15:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185398; cv=none; d=google.com; s=arc-20160816; b=uKeFtoSw/0LDLYyYv9N8cCU6Sk3tQAbBrJTPGB+OyeLZDOyC842RY/qaYzr2s5EfrK GaVTnXst9HzB2pMf6o05mZZ5F8PVNQMDuX7ZxuEoDJ++IL8me1jOj0nSw920GOHiGrrr pQ2Ltz1rrxb2D5CuG3taNKvzd627RzUGKpPgYZ/plWSlSTYeqXYYUtUl18zHGu9uvLDx XwJWtjPaSTUb8aOHKwmVNPBbMfUvx48sElxRhecUMbCjBcXMKFRq9/h5qejni+rplELB ecs/2jgeiNanVjnUZ9Y6lLcbHADFJ50ukrG7xVjD5HfueJ0F7iPDJCtOzFM3tQg1bC7a nfgA== 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=dZLAxv+BCVhxBhAi88rH3ubcZ7ViAxgZKMHtKGVaSdk=; b=JL54dv/tvpswMBSMDZUJKqm8bcG7jee8FNXqr/TPZ0EF+JPWmpNX89ktAUEU7oQaKM r2Obuq05d6iqxvwhHTAUm511Q5tNj9t/knMOROIaUvbI5bHu3r9uDRXYmEtaN+jSK3xT IHoIWc5C5bpbPgbvWsj47we3OwJW+oZtbs6vCpxa5Em0DpW2hK2FmA+xH1c3uElDhwrl eUrlYyw2NQQ+oRD58qWXdpjNAukrHjfyHTNanqW3ZsAKllS7kET1gnn5KzkJGQeJhqhv 3K8Yc42hLND9/yeyDGju31N60Jmx2d9xvF97bGZsERtK2+y+Fo43OnzseD3QX8TIhvzZ GSAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=umxaoZkD; 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 l63-v6si3125263plb.106.2018.09.05.15.09.43; Wed, 05 Sep 2018 15:09:58 -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=umxaoZkD; 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 S1729010AbeIFCkE (ORCPT + 99 others); Wed, 5 Sep 2018 22:40:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:55094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728380AbeIFCkE (ORCPT ); Wed, 5 Sep 2018 22:40:04 -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 7133E20869; Wed, 5 Sep 2018 22:07:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185272; bh=IH3x1VE17h0ZqOQAFJeX89qRMVcxqJzOr7EwsfWtpNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=umxaoZkDiMn0rhG59yM0Zadv4b0npi0JSfQB/TPRE1OxsV589Tbdc2U1Ha4Tdv821 mKrLGlJjvkyQ/2WjL5U5KO71HnCYZMa/dgNVfiiqPAQMk9WsUio1Fo0zww55UyerHB 7chAt85OBj0mACDmMd9fXYMZjD8yFVIwiGL758cg= 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 65/77] perf stat: Propagate 'struct target' arg to sort_aggr_thread() Date: Wed, 5 Sep 2018 19:04:28 -0300 Message-Id: <20180905220440.20256-66-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 Propagate the 'struct target' arg to sort_aggr_thread() so that the function does not depend on the 'perf stat' command object local variable 'target' and can 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-41-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index c4df076f1e54..486b0cf7818d 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1284,7 +1284,8 @@ static int cmp_val(const void *a, const void *b) static struct perf_aggr_thread_value *sort_aggr_thread( struct perf_evsel *counter, int nthreads, int ncpus, - int *ret) + int *ret, + struct target *_target) { int cpu, thread, i = 0; double uval; @@ -1309,7 +1310,7 @@ static struct perf_aggr_thread_value *sort_aggr_thread( * Skip value 0 when enabling --per-thread globally, * otherwise too many 0 output. */ - if (uval == 0.0 && target__has_per_thread(&target)) + if (uval == 0.0 && target__has_per_thread(_target)) continue; buf[i].counter = counter; @@ -1330,6 +1331,7 @@ static struct perf_aggr_thread_value *sort_aggr_thread( } static void print_aggr_thread(struct perf_stat_config *config, + struct target *_target, struct perf_evsel *counter, char *prefix) { FILE *output = config->output; @@ -1338,7 +1340,7 @@ static void print_aggr_thread(struct perf_stat_config *config, int thread, sorted_threads, id; struct perf_aggr_thread_value *buf; - buf = sort_aggr_thread(counter, nthreads, ncpus, &sorted_threads); + buf = sort_aggr_thread(counter, nthreads, ncpus, &sorted_threads, _target); if (!buf) { perror("cannot sort aggr thread"); return; @@ -1754,7 +1756,7 @@ perf_evlist__print_counters(struct perf_evlist *evlist, evlist__for_each_entry(evlist, counter) { if (is_duration_time(counter)) continue; - print_aggr_thread(config, counter, prefix); + print_aggr_thread(config, _target, counter, prefix); } break; case AGGR_GLOBAL: -- 2.14.4