From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933871AbdCJVZB (ORCPT ); Fri, 10 Mar 2017 16:25:01 -0500 Received: from mga01.intel.com ([192.55.52.88]:14856 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754391AbdCJVYw (ORCPT ); Fri, 10 Mar 2017 16:24:52 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,142,1486454400"; d="scan'208";a="74749955" From: Andi Kleen To: acme@kernel.org Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 03/13] perf, tools, stat: Handle partially bad results with merging Date: Fri, 10 Mar 2017 13:24:36 -0800 Message-Id: <20170310212446.6662-4-andi@firstfloor.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170310212446.6662-1-andi@firstfloor.org> References: <20170310212446.6662-1-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen 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 --- 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 0fd35be5520a..317024332bbd 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; -- 2.9.3