From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752982AbcEJUbf (ORCPT ); Tue, 10 May 2016 16:31:35 -0400 Received: from terminus.zytor.com ([198.137.202.10]:58146 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752947AbcEJUbc (ORCPT ); Tue, 10 May 2016 16:31:32 -0400 Date: Tue, 10 May 2016 13:30:59 -0700 From: tip-bot for Andi Kleen Message-ID: Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, jolsa@kernel.org, acme@redhat.com, hpa@zytor.com, ak@linux.intel.com, mingo@kernel.org, tglx@linutronix.de Reply-To: tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, ak@linux.intel.com, peterz@infradead.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com In-Reply-To: <1462489447-31832-8-git-send-email-andi@firstfloor.org> References: <1462489447-31832-8-git-send-email-andi@firstfloor.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat: Scale values by unit before metrics Git-Commit-ID: f340c5fc93bda334efd9f2b5855ef0d3746e1564 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f340c5fc93bda334efd9f2b5855ef0d3746e1564 Gitweb: http://git.kernel.org/tip/f340c5fc93bda334efd9f2b5855ef0d3746e1564 Author: Andi Kleen AuthorDate: Thu, 5 May 2016 16:04:04 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 9 May 2016 13:42:09 -0300 perf stat: Scale values by unit before metrics Scale values by unit before passing them to the metrics printing functions. This is needed for TopDown, because it needs to scale the slots correctly by pipeline width / SMTness. For existing metrics it shouldn't make any difference, as those generally use events that don't have any units. Signed-off-by: Andi Kleen Acked-by: Jiri Olsa Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1462489447-31832-8-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/stat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 4d9b481..ffa1d06 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -307,6 +307,7 @@ int perf_stat_process_counter(struct perf_stat_config *config, struct perf_counts_values *aggr = &counter->counts->aggr; struct perf_stat_evsel *ps = counter->priv; u64 *count = counter->counts->aggr.values; + u64 val; int i, ret; aggr->val = aggr->ena = aggr->run = 0; @@ -346,7 +347,8 @@ int perf_stat_process_counter(struct perf_stat_config *config, /* * Save the full runtime - to allow normalization during printout: */ - perf_stat__update_shadow_stats(counter, count, 0); + val = counter->scale * *count; + perf_stat__update_shadow_stats(counter, &val, 0); return 0; }