Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1866495ybb; Thu, 9 Apr 2020 10:26:46 -0700 (PDT) X-Google-Smtp-Source: APiQypK381qSGkGsc6rfDVfUl9RVhR/ajhOJGBP9oJnAjZYpjle6FGt4Tk9dAISeaJgW9HkpzA9q X-Received: by 2002:a37:ac19:: with SMTP id e25mr974211qkm.464.1586453206074; Thu, 09 Apr 2020 10:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586453206; cv=none; d=google.com; s=arc-20160816; b=M9BqWsdgq6JvlsrLSNy9UiJ0Sz4y60pR3CGw2VooGSMaZy//T/iEUDNfhmLFicC6+G +n4/Cer4fuO5yep7Dd0ZTpDnhgltFxEgnBpEmoMGkIuZWDXKsOAYmlriiZQl5dX4A0bu Kzlno7k6hwbjCqZ1Z0CTmHNPHoQpkVbinlK1wumFdp6ZzcmtfQKSggomvLBYkgeKd96j esOmM8ko2w5/+ucFoKnqzg6FdB4i5Xy1uG4WI9wjiZEZZn3wmqPmGok7wNtZs3fRoql9 y0hjNHq3OKPB+6NrDQnmp+TBsUYC+BWFQvSvTn323ec7YiIPEVLjlZh7AfxjJ/khzqmi QwHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mtjSwR8IguPOXLT021Rh82aVT+w9DQDweQ+imYBuk/8=; b=Snw/n9fux1I2rzjRC0wLupQMbZDrmZ902fJuJAZJpoCjdGtlj0hU34mAiBj0hodU45 LoD8pZDLpJuLwbhSwhyJGKcF901/8Zin8IrhmQCWXqzRNJy8bbfLizNYLOYnwycxXIEU dSY97ucVam9hQMy7L4cxKFbXnOApCqbEOU4U8300KTyIWgRX+MhVW0TaGqkeljAZreeG 1RkTC00mUBWmWan64rHa9fV5taHWdwpOtj53+e/R61/jAdoEVSAMpsZ0pm5jBvPSFsNV zkvuZmzuNmPDweVgfpm46OWR/RnhoOMv639jj7qqNKjNZzjvi/Tmg1wdVNzAMvSx+O5L oOXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="P/C/mQMK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x31si5695237qvf.122.2020.04.09.10.26.30; Thu, 09 Apr 2020 10:26:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="P/C/mQMK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728231AbgDIPnn (ORCPT + 99 others); Thu, 9 Apr 2020 11:43:43 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:22430 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728167AbgDIPnn (ORCPT ); Thu, 9 Apr 2020 11:43:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586447022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mtjSwR8IguPOXLT021Rh82aVT+w9DQDweQ+imYBuk/8=; b=P/C/mQMKU7epnIUDRvm0wnehLP8xs5OpqhxWaJWYtnmJG2MazrGcsPfcOslCBXXDWzK00S htvhJSpQXU94QzEOKuOVwiotsv7VoLOunCdhbLbl/jsGpkeXiXrGFgZt7ll84qp2ZnL9E5 iMSDp9gCMGc1gOgAk+wH0Fc3wEXM/yA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-429-ivM-dGSJM1eeyFLSix0CsA-1; Thu, 09 Apr 2020 11:43:38 -0400 X-MC-Unique: ivM-dGSJM1eeyFLSix0CsA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0021CDB66; Thu, 9 Apr 2020 15:43:36 +0000 (UTC) Received: from krava (unknown [10.40.196.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A33560BF3; Thu, 9 Apr 2020 15:43:34 +0000 (UTC) Date: Thu, 9 Apr 2020 17:43:32 +0200 From: Jiri Olsa To: Jin Yao Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com Subject: Re: [PATCH] perf stat: Zero ena and run for interval mode Message-ID: <20200409154332.GD3309111@krava> References: <20200409070755.17261-1-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200409070755.17261-1-yao.jin@linux.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 09, 2020 at 03:07:55PM +0800, Jin Yao wrote: > As the code comments in perf_stat_process_counter() say, > we calculate counter's data every interval, and the display > code shows ps->res_stats avg value. We need to zero the stats > for interval mode. > > But the current code only zeros the res_stats[0], it doesn't > zero the res_stats[1] and res_stats[2], which are for ena > and run of counter. > > This patch zeros the whole res_stats[] for interval mode. > > Signed-off-by: Jin Yao nice catch ;-) Acked-by: Jiri Olsa thanks, jirka > --- > tools/perf/util/stat.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c > index 5f26137b8d60..242476eb808c 100644 > --- a/tools/perf/util/stat.c > +++ b/tools/perf/util/stat.c > @@ -368,8 +368,10 @@ int perf_stat_process_counter(struct perf_stat_config *config, > * interval mode, otherwise overall avg running > * averages will be shown for each interval. > */ > - if (config->interval) > - init_stats(ps->res_stats); > + if (config->interval) { > + for (i = 0; i < 3; i++) > + init_stats(&ps->res_stats[i]); > + } > > if (counter->per_pkg) > zero_per_pkg(counter); > -- > 2.17.1 >