Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp41673ybj; Fri, 8 May 2020 06:08:52 -0700 (PDT) X-Google-Smtp-Source: APiQypL36i4vptzV7ycBQf4pojtf8p3KxciYBrfTZB7oKQ/61rnK++U0VyO2AJxXAvWAMYqta1Yh X-Received: by 2002:a17:906:8699:: with SMTP id g25mr1837944ejx.365.1588943332222; Fri, 08 May 2020 06:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588943332; cv=none; d=google.com; s=arc-20160816; b=iCdDWnxaDZOdfX3PcJ2VlKAGwUWYSC7V8ZGogQiw+0aM3kMCg8pvh7LT0mSwrZchcr 2SEaaTJ3oFxq0VYQwMWsvqV33/JpXaLxEU7OZ4834MUcp1oHnfcIINuORAirbJprL8M0 AUErstlwI13dw7vvfwJLV/+vaNDT0pgxvkVI0w6EkPRM/Es7kvCvLmhhGmU742b5u7TL JJQaAy8xUCwa20xScAPXhrAxszk1RQ3IeFUhKuvX087MOImNjRZXCWGARVkQGYx0s29A wcemMuxyOmIdg4ff7z6SWd2yeDLrAyfdbrEYdxsNhotFg6YfdWXX1UJdGpLyfVAarLIO 0kSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=Vn38SP8AzyaLrOyv06ckNgIEM1dc/7PnNr/xlZqfjH0=; b=0rBhQS1AXa0TsEaA28Vo8Nx1NOx3MJ+a5kPk7GifpZYLkY+E1Ti6rjJq8+rLSuOmRQ EAmk9wEIK3oeul3SrrGah9HtaDuuydzVMWf6L0PptVRqNvtEIEN16gjC8SwxcW02ohaf ZkrrW4SYxV9uVeQCQuRLiGTLqH7aRQ/F8oZEROp++KMMgo3NOjnDlKz28QiKR3pLTBV+ 3538DDM4lqjOcJyInMPJ5ABFIUpZmOMQf74/T88s5O8C3tWHeK57zbNlXFQH9CA714cL gdzjgJcXbzM7HoAeP5nFI/fAT6ah0Hn3E7YVdM5VClTtcUaN2dRDcVZ+592hH1u9zC3b Y5lA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v25si867012ejx.386.2020.05.08.06.08.04; Fri, 08 May 2020 06:08:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729765AbgEHNGL (ORCPT + 99 others); Fri, 8 May 2020 09:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729714AbgEHNFl (ORCPT ); Fri, 8 May 2020 09:05:41 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CCA6C05BD0A; Fri, 8 May 2020 06:05:41 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jX2h3-0007wP-Cb; Fri, 08 May 2020 15:05:33 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 20AAA1C0823; Fri, 8 May 2020 15:05:14 +0200 (CEST) Date: Fri, 08 May 2020 13:05:14 -0000 From: "tip-bot2 for Jin Yao" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf stat: Zero all the 'ena' and 'run' array slot stats for interval mode Cc: Jin Yao , Alexander Shishkin , Andi Kleen , Jin Yao , Jiri Olsa , Kan Liang , Peter Zijlstra , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200409070755.17261-1-yao.jin@linux.intel.com> References: <20200409070755.17261-1-yao.jin@linux.intel.com> MIME-Version: 1.0 Message-ID: <158894311407.8414.15193131154587476786.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 0e0bf1ea1147fcf74eab19c2d3c853cc3740a72f Gitweb: https://git.kernel.org/tip/0e0bf1ea1147fcf74eab19c2d3c853cc3740a72f Author: Jin Yao AuthorDate: Thu, 09 Apr 2020 15:07:55 +08:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Wed, 22 Apr 2020 15:51:01 -03:00 perf stat: Zero all the 'ena' and 'run' array slot stats for interval mode 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. Fixes: 51fd2df1e882 ("perf stat: Fix interval output values") Signed-off-by: Jin Yao Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jin Yao Cc: Jiri Olsa Cc: Kan Liang Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20200409070755.17261-1-yao.jin@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo --- 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 5f26137..242476e 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);