From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932582AbcFAO47 (ORCPT ); Wed, 1 Jun 2016 10:56:59 -0400 Received: from mga09.intel.com ([134.134.136.24]:38958 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932543AbcFAO45 (ORCPT ); Wed, 1 Jun 2016 10:56:57 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,401,1459839600"; d="scan'208";a="819403854" Date: Wed, 1 Jun 2016 07:56:48 -0700 From: Andi Kleen To: Nilay Vaish Cc: Andi Kleen , acme@kernel.org, jolsa@kernel.org, Linux Kernel list Subject: Re: [PATCH 2/4] perf stat: Add computation of TopDown formulas Message-ID: <20160601145648.GP22049@tassilo.jf.intel.com> References: <1464119559-17203-1-git-send-email-andi@firstfloor.org> <1464119559-17203-2-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 01, 2016 at 09:50:07AM -0500, Nilay Vaish wrote: > On 24 May 2016 at 14:52, Andi Kleen wrote: > > +static double td_be_bound(int ctx, int cpu) > > +{ > > + double sum = (td_fe_bound(ctx, cpu) + > > + td_bad_spec(ctx, cpu) + > > + td_retiring(ctx, cpu)); > > + if (sum == 0) > > + return 0; > > + return sanitize_val(1.0 - sum); > > +} > > + > > Can you explain why we need the check on sum? You mean the if statement? Otherwise if nothing was measured it would always report everything backend bound, which wouldn't be correct. -Andi -- ak@linux.intel.com -- Speaking for myself only