From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753129AbcFBL5d (ORCPT ); Thu, 2 Jun 2016 07:57:33 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:35303 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750811AbcFBL5b (ORCPT ); Thu, 2 Jun 2016 07:57:31 -0400 MIME-Version: 1.0 In-Reply-To: <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> <20160601145648.GP22049@tassilo.jf.intel.com> From: Nilay Vaish Date: Thu, 2 Jun 2016 06:56:51 -0500 Message-ID: Subject: Re: [PATCH 2/4] perf stat: Add computation of TopDown formulas To: Andi Kleen Cc: Andi Kleen , acme@kernel.org, jolsa@kernel.org, Linux Kernel list Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andi, I am talking about the if statement. I don't know why it would happen that nothing got measured. I am guessing you saw it happen. May be we can add a comment in the patch that it is possible that all counter values are zero and therefore we need that if statement. -- Nilay On 1 June 2016 at 09:56, Andi Kleen wrote: > 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