From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966038AbdCXSt3 (ORCPT ); Fri, 24 Mar 2017 14:49:29 -0400 Received: from terminus.zytor.com ([65.50.211.136]:32989 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965758AbdCXStT (ORCPT ); Fri, 24 Mar 2017 14:49:19 -0400 Date: Fri, 24 Mar 2017 11:48:03 -0700 From: tip-bot for Andi Kleen Message-ID: Cc: hpa@zytor.com, ak@linux.intel.com, acme@redhat.com, linux-kernel@vger.kernel.org, mingo@kernel.org, jolsa@kernel.org, tglx@linutronix.de Reply-To: mingo@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, jolsa@kernel.org, ak@linux.intel.com, hpa@zytor.com In-Reply-To: <20170320201711.14142-4-andi@firstfloor.org> References: <20170320201711.14142-4-andi@firstfloor.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat: Handle partially bad results with merging Git-Commit-ID: b4229e9d4cac2295f8f04ec26acd571a391c6c37 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: b4229e9d4cac2295f8f04ec26acd571a391c6c37 Gitweb: http://git.kernel.org/tip/b4229e9d4cac2295f8f04ec26acd571a391c6c37 Author: Andi Kleen AuthorDate: Mon, 20 Mar 2017 13:17:01 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 21 Mar 2017 16:07:00 -0300 perf stat: Handle partially bad results with merging When any result that is being merged is bad, mark them all bad to give consistent output in interval mode. No before/after, because the issue was only found in theoretical review and it is hard to reproduce Signed-off-by: Andi Kleen Acked-by: Jiri Olsa Link: http://lkml.kernel.org/r/20170320201711.14142-4-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index a4da10a..cd7dc3b 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1237,6 +1237,16 @@ static void aggr_cb(struct perf_evsel *counter, void *data, bool first) if (first) ad->nr++; counts = perf_counts(counter->counts, cpu, 0); + /* + * When any result is bad, make them all to give + * consistent output in interval mode. + */ + if (counts->ena == 0 || counts->run == 0 || + counter->counts->scaled == -1) { + ad->ena = 0; + ad->run = 0; + break; + } ad->val += counts->val; ad->ena += counts->ena; ad->run += counts->run;