Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp70542imm; Wed, 5 Sep 2018 15:10:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZK3sc2RpS6YasFNQdGlNkiP1I2O94PkEJdHK5NcuNooSI+RN9+AaVddoTyKpVEKgC5jxu8 X-Received: by 2002:a63:344b:: with SMTP id b72-v6mr38789593pga.184.1536185420342; Wed, 05 Sep 2018 15:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185420; cv=none; d=google.com; s=arc-20160816; b=eu7qSV7Hzhmyk6rseKY7UovJHAnfTcV6XJA0SwfjMYzqVTmX6jUX5dimlEiSuZyvJw PieIq14qvxDGvea/Hurn+kvmWPgA60ZB/mZAhO2i/bEPNAXgVC1wTlOB/brzkOH4gB9C zygujN9BQBiaKsSpH9ARsSAJkM/V5PNOAACl54jFmdtiRnJoXfN3V3Ifwptk7E+PM3QF hW/oyeeNFBC/4ATaOJRH5MOkOBG+5g+YLoKRdLhqe9EwWFt+84b1nzDAkwSqil7IYpoC jvK9voc+gg7Iq03BUEZcDAursb54hT/EkkazCw+cbqK0ehgKUBFIaNs0SLZ2+fKXr4In CvtQ== 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=GT4Pqre2QfioX02fAbTncPneuGQbyZ96g5Xo3vF3kQA=; b=S5xwlCJrHuZikQ2eY5hvjwI6ae88yaAhSmVHO+oFGx+tZjD681U+jVhZgiaCT3mGOI ztXeH5iTr1GNlvHWBT/k2EXUUmIXQvkNksR4XyxNJRwlYmMmE41r9gRjgmIGF875cJtS IdGk3hTROi5Ux9+oLrk6ZFA3Pd+CZBSq2/mYaH+UBS1c3x3CReGE3oMBh0hoYgqnkcvl AY2m2cUPwUYgaI9WW8+CW3zX0wBO7/1Jzil/Rn3EjUDqxPNmfiEptq9PLJT88DEWMCy4 iACl8ctZHpGA7wR+ddfYpa1UBrUSRBXhClIJRA57QrhNmco7dOQsSd+OJUNOcF4dT9ST iDNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SKsoTzFq; 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 r7-v6si3275450pga.77.2018.09.05.15.10.05; Wed, 05 Sep 2018 15:10:20 -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=SKsoTzFq; 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 S1728783AbeIFCjT (ORCPT + 99 others); Wed, 5 Sep 2018 22:39:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:54040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727593AbeIFCjS (ORCPT ); Wed, 5 Sep 2018 22:39:18 -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 01A5420652; Wed, 5 Sep 2018 22:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185226; bh=aJgB5wzlD+4Gdk07kfNrtv4L0hOZBbHI0+6YVTOd0DU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SKsoTzFqfMhP07N/EE5wF47g9qmAGP3bYtp4K3xS/DQxRtr7JxOopXBP5iwVYZ/EK 59HT/iMObG+5EQxkkWnqLtsCWf6RB3rfyEAEEjf7kL4Cc0iCVRMTqXMSDMJgpZtSRZ 3Gdcjqd3uCSldnf+4gAdG+IAbiy7qsuckgJfYQfQ= 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 49/77] perf stat: Add 'target' argument to perf_evlist__print_counters() Date: Wed, 5 Sep 2018 19:04:12 -0300 Message-Id: <20180905220440.20256-50-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 'struct target' argument to perf_evlist__print_counters(), so the function does not depend on the 'perf stat' command object local 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-25-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 24171aa6c41f..528f85146b59 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1590,6 +1590,7 @@ static void print_interval(struct perf_stat_config *config, } static void print_header(struct perf_stat_config *config, + struct target *_target, int argc, const char **argv) { FILE *output = config->output; @@ -1600,18 +1601,18 @@ static void print_header(struct perf_stat_config *config, if (!config->csv_output) { fprintf(output, "\n"); fprintf(output, " Performance counter stats for "); - if (target.system_wide) + if (_target->system_wide) fprintf(output, "\'system wide"); - else if (target.cpu_list) - fprintf(output, "\'CPU(s) %s", target.cpu_list); - else if (!target__has_task(&target)) { + else if (_target->cpu_list) + fprintf(output, "\'CPU(s) %s", _target->cpu_list); + else if (!target__has_task(_target)) { fprintf(output, "\'%s", argv ? argv[0] : "pipe"); for (i = 1; argv && (i < argc); i++) fprintf(output, " %s", argv[i]); - } else if (target.pid) - fprintf(output, "process id \'%s", target.pid); + } else if (_target->pid) + fprintf(output, "process id \'%s", _target->pid); else - fprintf(output, "thread id \'%s", target.tid); + fprintf(output, "thread id \'%s", _target->tid); fprintf(output, "\'"); if (run_count > 1) @@ -1716,6 +1717,7 @@ static void print_footer(struct perf_stat_config *config) static void perf_evlist__print_counters(struct perf_evlist *evlist, struct perf_stat_config *config, + struct target *_target, struct timespec *ts, int argc, const char **argv) { @@ -1727,7 +1729,7 @@ perf_evlist__print_counters(struct perf_evlist *evlist, if (interval) print_interval(config, prefix = buf, ts); else - print_header(config, argc, argv); + print_header(config, _target, argc, argv); if (metric_only) { static int num_print_iv; @@ -1789,7 +1791,7 @@ static void print_counters(struct timespec *ts, int argc, const char **argv) if (STAT_RECORD && perf_stat.data.is_pipe) return; - perf_evlist__print_counters(evsel_list, &stat_config, + perf_evlist__print_counters(evsel_list, &stat_config, &target, ts, argc, argv); } -- 2.14.4